<!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>body,div,span{ margin:0; padding:0;}#first{? ? width:200px; height:200px; position:relative; background:#F00; cursor:pointer; top:0; left:-200px;}#first span{? ? background:#00C; width:30px; height:50px;? ? border-radius:2px; font-size:20px; text-align:center; position:absolute; left:200px; top:75px; color:#FFF;} ? ??</style><script type="text/javascript">window.onload=function(){? ?var oDiv=document.getElementById('#first');? ?oDiv.onmouseover=function(){? ? ? ? starMove(); ?? } }var timer=null;function starMove(){ clearInterval(timer); var oDiv=document.getElementById('#first'); timer=setInterval(function(){ if(oDiv.offsetLeft==0){ clearInterval(timer); }else{ oDiv.style.left=oDiv.offsetLeft+10+'px'; } },30)? ?}</script></head><body>?<div id=first><span>分享</span></div></body></html>這是他的錯誤提示:Uncaught TypeError: Cannot set property 'onmouseover' of null
我覺得我的沒有問題啊,為什么老是提示我說我的onmouseover定義不了呢?
慕仰6432972
2016-08-06 11:01:04