<!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:0px;
padding:0px;
}
#pic{
width:200px;
height:200px;
background-color:#FF66FF;
top:0;
position:relative;
left:-200px;
}
#fire{
width:20px;
height:40px;
position:absolute;
top:70px;
left:200px;
color:#6600FF;
background-color:#FFFF66;
}
</style>
<script type="text/javascript">
window.onload=function(){
var oDiv=document.getElementById("pic");
oDiv.onmouseover=function(){
startMove(0);
}
}
var timer=null;
function startMove(){
var oDiv=document.getElementById("div1")
timer=setInterval(function(){
if(pDiv.offsetLeft==0){
clearInterval(timer);
}
else{
oDiv.style.left=oDiv.offsetLeft+10+'px';
}
},30)
}
</script>
</head>
<body>
<div id="pic"><span id="fire">滑动</span></div>
</body>
</html>
淡雅的默
相关分类