在事件切换器的时候,我在html文件写了一行代码<div class="box">ggg</div>css部分代码为.box{width:200px;height:200px;background-color:red;}.pox{width:100px;height:200px;background-color:green;}js代码是window.onload=function(){var box=document.getElementById("box");box.onclick=toBlack;};function toBlack(){this.className='pox';}但firebug说uncaught TypeError: Cannot set property 'onclick' of null求指导,为啥不行,不理解
添加回答
举报
0/150
提交
取消