大佬們,看看問題在哪,一點(diǎn)反應(yīng)都沒有
<!doctype html>
<html>
<head>
<style type="text/css">
#s{font-size: 13px;
color: white;
height: 30px;
width: 20px;
position: absolute;
top: 100px;
left: 0px;
background-color: aqua;
}
#ss{
height:230px;
width: 960px;
position: absolute;
top: 0px;
left: -960px;
background-color: brown;
}
</style>
<script type="text/javascript">
window.onload=function(){
var s1=document.getElementById("s");
s1.onmouseover=function(){
startmove();
}
}
var timer=null;
function startmove(){
var s2=document.getElementById("ss");
timer=setInterval(function(){
if(s2.offsetLeft==0){
clearInterval(timer);
}
else{
s2.style.left=s2.offsetLeft+10+'px';
}
},30);
}
</script>
<meta charset="utf-8">
<title>動態(tài)效果</title>
</head>
<body>
<div id="s">廣<br>告</div>
<div id="ss"></div>
</body>
</html>
2018-06-14
你的html結(jié)構(gòu)寫錯(cuò)了
<div id="s">廣<br>告</div>
<div id="ss"></div>
改成<div id="s"><span id='ss'>廣告</span></div>