多個(gè)動(dòng)畫(huà)獲取樣式
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html?xmlns="http://www.w3.org/1999/xhtml"> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>無(wú)標(biāo)題文檔</title> <style?type="text/css"> *{margin:0;padding:0;} ul{list-style:none;} li{display:block;margin-top:10px;height:100px;width:100px;background-color:#CCC;border:5px?solid?#FC3} </style> <script?type="text/javascript"> window.onload=function(){ var?ali=document.getElementsByTagName("li"); for(i=0;i<ali.length;i++){ ? ?ali[i].onmouseover=function(){startMove(this,200)}; ?ali[i].onmouseout=function(){startMove(this,100)}; } } function?startMove(obj,target){ clearInterval(obj.timer); obj.timer=setInterval(function(){ var?speed=(target-parseInt(getStyle(obj,"width")))/8; speed=speed>0?Math.ceil(speed):Math.floor(speed); if(parseInt(getStyle(obj,"width"))==target){clearInterval(obj.timer)} else{obj.style.width=parseInt(getStyle(obj,"width"))+speed+"px"} },30) } function?getStyle(obj,attr){ if(obj.currentStyle){ return?obj.currentStyle[attr] } else{return?getComputedStyle(obj,false)[attr];} } </script> </head> <body> <ul> ?<li></li> ?<li></li> ?<li></li> ?<li></li> </ul> </body> </html>
代碼如上,在Dreamweaver里面運(yùn)行不了,但在搜狗瀏覽器里可以運(yùn)行,求大神解答這是為什么呀?代碼有什么錯(cuò)誤嗎?
2016-05-11
嗯經(jīng)評(píng)測(cè) 在DW里運(yùn)行在 FireFox,Chrome,IE8
都可以運(yùn)行的。
2016-05-12
我也遇到了這個(gè)問(wèn)題,代碼只在IE中能夠運(yùn)行。firefox和DW均無(wú)法運(yùn)行,請(qǐng)問(wèn)樓主問(wèn)題解決了么