Javascript examples for DOM:Document getElementById
Get a HTML element without getElementById
<html> <head> <script type="text/javascript"> // set a global var to acces the elements in the HTML document var doc = this;//from w w w. jav a 2s.c o m function testIt() { doc.blaat.innerHTML = 'It works!!'; } </script> </head> <body> <div id="blaat"> Will this ever work..?! </div> <button onclick="testIt()">Click me and you'll see!</button> </body> </html>