Now I know how. Every HTML tag or page element can be accessed in javascript. Just tag your element with an id:
<div id='abc'></div>
to access the element, use this javascript
var element = document.getElementById('abc');
each object in javascript can have functions or properties, but all of these can be accessed as an associative array,
so to list all of the element's properties and functions you can do this:
var str = '';
for(var property in myObject) {
var value = myObject[property];
str+= "\n" + "myObject[" + property + "] = " + value;
}
alert(str);
You will notice a different set of properties displayed in IE, Safari, Firefox, etc.
http://en.wikipedia.org/wiki/Associative_arrays
No comments:
Post a Comment