亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

鼠標移出沒反應

鼠標移出沒反應

xiemioc 2016-06-04 08:33:36
<!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><script>window.onload = function(){ var xiem = document.getElementById('xie'); xiem.onmousemove =function(){? ? ? startMove();? ? ? ? }? ? xiem.onmouseout = function(){ startMOve1(); }? ?}var time = null;function startMove(){ clearInterval(time); time = setInterval(function(){ var xiem = document.getElementById('xie'); if(xiem.offsetLeft== 0){? ? clearInterval(time);? ? } else{ xiem.style.left=xiem.offsetLeft+10+'px'; } },30)}function startMove1(){ var time = null; clearInterval(time); time = setInterval(function(){ var xiem = document.getElementById('xie'); if(xiem.offsetLeft==-200){? ? clearInterval(time);? ? } else{ xiem.style.left=xiem.offsetLeft-10+'px'; } },30)}</script><style type="text/css">*{margin:0; padding: 0;}#xie{width:230px;? ? ?height:100px; background:#666;? font-size:16px; position:relative;? ? ?left:-200px;}</style></head><body><div id="xie"></div></body></html>
查看完整描述

2 回答

已采納
?
qq_大寒_2

TA貢獻173條經驗 獲得超185個贊

window.onload?=?function(){
var?xiem?=?document.getElementById('xie');
xiem.onmousemove?=function(){
????startMove();
????????}
????xiem.onmouseout?=?function(){
startMove1();
}
???}

startMOve1()=>startMove1(); 小寫o

查看完整回答
3 反對 回復 2016-06-04
?
剛毅87

TA貢獻345條經驗 獲得超309個贊

? 你是不是想用鼠標移入事件 onmouseenter 或 onmouseover

onmousemove 是鼠標移動事件

查看完整回答
反對 回復 2016-06-04
  • 2 回答
  • 0 關注
  • 1589 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號