源自:6-2 完美运动框架
不理解为什么一直提示联系.html:23 Uncaught TypeError: Cannot set property 'onmouseover' of nul ,检查了好多遍,不懂问题出在那块儿,哪位大神帮忙看下,谢谢l
dbhs
div{
width:200px;
height:100px;
background-color:yellow;
border:2px solid #000;
opacity: 0.3;
filter:alpha(opacity:30);
}
window.οnlοad=function(){
var odiv =document.getElementById("div");
odiv.οnmοuseοver=function(){
startMove(odiv,'width',400);
}
}
function startMove(obj,attr,iTarget,fn){
clearInterval(obj.timer);
obj.timer=setInterval(function(){
var icur=null;
if(attr=='opacity'){
icur=Math.round(parseFloat(getStyle(obj,attr))*100);
}else{
icur=parseInt(getStyle(obj,attr));
}
var speed=(iTarget-icur)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(icur==iTarget){
clearInterval(obj.timer);
if(fn){
fn();
}
}else{
if(attr=='opacity'){
obj.style.filter='alpha(opacity:'+(icur+speed)+')';
obj.style.opacity=(icur+speed)/100;
}else{
obj.style[attr]=icur+speed+'px';
}
}
},30)
}
function getStyle(obj,attr){
if(obj.currentStyle){
return obj.currentStyle[attr];
}else{
return getComputedStyle(obj,false)[attr];
}
}
提问者:control123
2016-09-23 15:42