猿问

JavaScript实现动画,但是却实现不了

<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=gb2312">

<title>jQuery操作CSS3样式</title>
<link rel="stylesheet" type="text/css" href="lsq.css"/>

<style>

#mydiv{
position:absolute;
width:50px;
height:50px;
background:none repeat scroll 0% 0% rgb(255,0,0);
 left:0px;
position:absolute;


}

</style>
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
</head>

<body onLoad="test()">
<div id="mydiv" >
</div>

</body>
<script>
function test(){
var obj=document.getElementById('mydiv');
function changeStyle(){
obj.style.left=parseInt(obj.style.left)+20+'px';
}
setInterval(changeStyle,40);
}

</script>
</html>

 

 

 

应该是向右滑动,但是却不滑动.用了 chrome  IE   和  火狐,,都不行..

望各位大神指教.

温温酱
浏览 528回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答