This discovery amazed me. Apparently, in Netscape 6, all HTML elements inherit from a base object called HTMLElement. Because of this, we can add methods to this base object using prototype, and all of our elements will have these methods(/properties?) available to them. For a simple example:
<body onLoad="document.getElementById('ben').move(170,300)">
<div id="ben" style="position:absolute;">
dsfsdgsfgfs
</div>
<script>
HTMLElement.prototype.move = function(x,y)
{
this.style.left = x+"px";
this.style.top = y+"px";
}
</script>
Test this in NS6. If anyone knows of a similar object like HTMLElement in IE, please tell me!
Thanks to Erik from for helping me realize this by mistake jared@aauser.com
<body onLoad="document.getElementById('ben').move(170,300)">
<div id="ben" style="position:absolute;">
dsfsdgsfgfs
</div>
<script>
HTMLElement.prototype.move = function(x,y)
{
this.style.left = x+"px";
this.style.top = y+"px";
}
</script>
Test this in NS6. If anyone knows of a similar object like HTMLElement in IE, please tell me!
Thanks to Erik from for helping me realize this by mistake jared@aauser.com