如下是我学习时写的代码,但是一运行网页JS里面的那几个按钮事件就自动运行了,不知道我哪里搞错了,我在百度上找了看到按钮事件是像这样写的呀。请大能帮帮小弟,看小弟是哪里搞错了,谢谢哈。代码:PageTitlediv{width:200px;height:200px;background:#998820;}window.onload=function(){varoBut_1=document.getElementById('obut_1');varoBut_2=document.getElementById('obut_2');varoBut_3=document.getElementById('obut_3');functionGored(odiv_qu,property,price,shebiao){varoDiv=document.getElementById(odiv_qu);oDiv.style.background=shebiao;oDiv.style[property]=price;}alert(oBut_1);oBut_1.onclick=alert("sdsd");oBut_1.onclick=Gored('oDiv_s','width','25rem','green');oBut_2.onclick=Gored('oDiv_s','height','15rem','#003320');oBut_3.onclick=Gored('oDiv_s','','','#022545');}
添加回答
举报
0/150
提交
取消