Tutorial 6 JS
Tutorial 6 JS
• DOM/Event
Handlers.
Execution Environment for JavaScript
• In JavaScript binding,
• HTML elements -->objects
• HTML element attributes --> properties
<input type = "text" name = " address>
would be represented as one object with two properties, type
and name, with the values "text" and "address“.
Element Access in JavaScript
• DOM 0 uses forms and element arrays
<form action ="">
<input type = "button" name = "pushMe">
</form>
• DOM 0 address: documents.forms[0].element[0]
Ques 2. Write a JavaScript program to count and display the items of a dropdown list,
in an alert window.
Ques 3. Write a JavaScript program which prints the elements of the following array.
Note : Use nested for loops.
Sample array : var a = [[1, 2, 1, 24], [8, 11, 9, 4], [7, 0, 7, 27], [7, 4, 28, 14], [3, 10, 26, 7]];
Sample Output :
"row 0"
" 1"
" 2"
" 1"
" 24"
"row 1"