<!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>my运动</title><!-- <link href="运动.css" type="text/css" rel="stylesheet"/><script src="运动.js" type="text/javascript"></script> --><style type="text/css">*{ margin:0; padding:0;font-family:"宋体";}#myblock{width:200px;height:200px;background:#99CC33;position:relative;left:-200px;top:0;}#myblock span{width:50px;height:50px;position:absolute;left:200px;top:150px;background:#9900FF;}</style><script type="text/javascript">function mouseOver(L){ var timer=null; clearInterval(timer); var adiv=document.getElementById("myblock"); timer= setInterval(function(){ var v=0; if(adiv.offsetLeft>L){ v=-10; } else{ v=10; } if(adiv.offsetLeft==L){ clearInterval(timer); } else{ adiv.style.left=adiv.offsetLeft+v+'px'; } },30);}</script></head><body> <div id="myblock" onmouseover="mouseOver(0)" onmouseout="mouseOver(-200)" > <span >一个</span> </div></body></html>
添加回答
举报
0/150
提交
取消