多個動畫獲取樣式
<!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>無標題文檔</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里面運行不了,但在搜狗瀏覽器里可以運行,求大神解答這是為什么呀?代碼有什么錯誤嗎?
2016-05-11
嗯經(jīng)評測 在DW里運行在 FireFox,Chrome,IE8
都可以運行的。
2016-05-12
我也遇到了這個問題,代碼只在IE中能夠運行。firefox和DW均無法運行,請問樓主問題解決了么