Difference between revisions of "Introduction to JavaScript Fall 2011 Class 2"

esse quam videri
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
=Lecture=
 
=Lecture=
Introduction:
+
==Setting up your environment==
  
Where to put script:
+
==Where to put script==
  
Using the console:
+
==Using the console==
  
variable types:
+
==variable types==
  
 
(why to use var)
 
(why to use var)
Line 17: Line 17:
 
*more later
 
*more later
  
Conditional Statements
+
==Conditional Statements==
  
  <div id="content">
 
 
   <form>
 
   <form>
 
   <input id="password" type="password"/>
 
   <input id="password" type="password"/>
 
   <input id="checkIt" type="submit" />
 
   <input id="checkIt" type="submit" />
 
   </form>
 
   </form>
  <h1 id="result">
 
 
 
  </h1>
 
 
 
  </div>
 
  
  var password = "hidden";
 
  var result;
 
 
    
 
    
 
   document.getElementById('checkIt').onclick = function(){
 
   document.getElementById('checkIt').onclick = function(){

Latest revision as of 04:22, 13 September 2011

Back to Introduction to JavaScript Fall 2011

Lecture

Setting up your environment

Where to put script

Using the console

variable types

(why to use var)

  • string

( \ escape characters )

  • number
  • bool
  • more later

Conditional Statements

 	<form>
 		<input id="password" type="password"/>
 		<input id="checkIt" type="submit" />
 	</form>


 document.getElementById('checkIt').onclick = function(){
 	if(document.getElementById('password').value === password){
 		result = "access granted";
 	} else {
 		result = "DENIED!";
 	}
 document.getElementById('result').appendChild(document.createTextNode(result));
 //document.getElementById('result').firstChild.nodeValue = result;
 return false;
 }

Homework

In-Class 2

In-Class 2 details

In-Class 3

In-Class 3 details

Assignment 2

Assignment 1 details