什么效果都沒有
<style>
?*{margin:0;padding:0;}
#div1{width:300px;height:300px;background:#ccc;position:relative;left:-300px;}
#div1 span{display:block;width:50px;height:100px;position:absolute;left:300px;background:#06F;}
</style>
</head>
<body>
<div id="div1"><span>分享</span></div>
<script>
? ?window.onload = function(){
? var oDiv = document.getElementById("div1");
? oDiv.onmouseover = function(){
? startMove();
??
? }
? }
? function starMove(){
var oDiv = document.getElementById("div1");
setInterval(function(){
oDiv.style.left = ODiv.offsetLeft+10+'px';
},30)
? }
</script>
2015-10-11
<style>body,div,span{margin:0;padding:0;}#div1{background-color: #F00;height: 200px;width: 200px;
position: relative;left: -200px;top:10px;}#div1 #share{width:20px;height:50px;background-color:#00F;
position:absolute;left:199px;top:78px;}</style><scriptlanguage="text/javascript">window.onload=function(){? ? var oDiv=document.getElementById("div1");? oDiv.onmouseover=function(){? ? ?startMove(0);}
? ? oDiv.onmouseout=function(){?startMove(-200);?}}? ? var timer=null;function startMove(iTarget){? ? clearInterval(timer);?var oDiv =document.getElementById("div1");? ? timer=setInterval(function(){
var speed=0;?if(oDiv.offsetLeft>iTarget){? speed=-10;?}else{speed=10;?}?if(oDiv.offsetLeft==iTarget){
?clearInterval(timer);?}?else{?oDiv.style.left=oDiv.offsetLeft+speed+"px";?}?},30)? }</script></head>
可以幫忙看一下代碼嗎?我的效果也不出來,查看了好多遍都沒發(fā)現(xiàn)錯誤
2015-09-19
肯定沒有啦,函數(shù)名和變量名都寫錯了怎么會有效果呢