I can't figure out what i'm doing wrong.. here is an example which i want to turn a div's background colour to grey when clicked but it doesn't work :(
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html><head><title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <script type="text/javascript">
- document.getElementById("box").addEventListener('click',doSomething,false);
- function doSomething() {
- this.style.backgroundColor = '#555555';
- }
- </script>
- </head>
- <body>
- <div id="box" style="background-color:blue; height:200px; width:200px;"> </div>
- </body>
- </html>]