Difference between revisions of "Introduction to JavaScript Fall 2011 Class 2"
esse quam videri
Line 17: | Line 17: | ||
*more later | *more later | ||
− | Conditional Statements | + | Conditional Statements: |
<div id="content"> | <div id="content"> | ||
Line 29: | Line 29: | ||
</div> | </div> | ||
+ | |||
+ | |||
var password = "hidden"; | var password = "hidden"; |
Revision as of 04:17, 13 September 2011
Back to Introduction to JavaScript Fall 2011
Lecture
Introduction:
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>
var password = "hidden"; var result; 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; }