参见英文答案 >
Why does jQuery or a DOM method such as getElementById not find the element?6个
为什么这段代码不起作用?我正在使用FF.
为什么这段代码不起作用?我正在使用FF.
- <head>
- <script type="text/javascript">
- document.getElementById("someID").onclick = function(){
- alert("Yahooo");
- }
- </script>
- </head>
- <body>
- <a href="#" id="someID">someID</a>
- </body>
- </html>
我得到javascript错误getElementById等于null.