完整js代码//改变行间样式函数functionchangeStyle(elem,name,value){elem.style[name]=value;//为什么不能写成elem.style.name=value}//执行改变属性函数window.onload=function(){varoSubmitBtn=document.getElementById("submit");varoResetBtn=document.getElementById("reset");varoInput=document.getElementsByTagName("input");varoDiv=document.getElementById("div1");oSubmitBtn.onclick=function(){changeStyle(oDiv,oInput[0].value,oInput[1].value);}oResetBtn.onclick=function(){oDiv.removeAttribute("style");}}问题是第一个函数内部如果改成elem.style.name=value就不行了,求解
添加回答
举报
0/150
提交
取消