JavaScript: The Basics

Ramit Malhotra

ramit@ischool.berkeley.edu

School of Information, UC Berkeley

JAVA..SCRIPT?

Location:

Debugging:

JS - Variables and Operators

Variables

Operators

JS programming constructs

Conditional Statements

Loopy statments!

JS Arrays and Objects

Arrays

Objects

JS DOM content manipulation

Getting stuff from the DOM - using the 'document' object

Putting stuff into the DOM

	 var newDiv = document.createElement("div"); 
         var newContent = document.createTextNode("Hi there and greetings!"); 
         newDiv.appendChild(newContent); //add the text node to the newly created div. 
         
         // add the newly created element and its content into the DOM 
         var currentDiv = document.getElementById("div1"); 
         document.body.insertBefore(newDiv, currentDiv);