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

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

實現圖片右移顯示的代碼錯誤

實現圖片右移顯示的代碼錯誤

慕粉3900206 2016-09-20 23:54:58
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Web Design</title><link rel="stylesheet" type="text/css" href="layoutstyle.css"></head><body><h1>Web Design</h1><p>these are the things you should know.</p><ol id="linklist"><li><a href="structure.html">Structure</a></li><li><a href="presentation.html">Presentation</a></li><li><a href="behavior.html">Behavior</a></li></ol><div id="slideshow"><img src="j_06.jpg" alt="building blocks of web design" id="preview"></div><script ?src="slideshow.js"></script></body></html>//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////window.onload=Slideshow;function Slideshow() { var preview=document.getElementById("preview"); preview.style.positon="absolute"; preview.style.left="0px"; preview.style.top="0px"; //取得表中所有連接 var list=document.getElementById("linklist"); var links=list.getElementsByTagName("a"); //為mouseover事件添加動畫效果 links[0].onmouseover=function() { moveElement("preview",-100,0,10); } links[1].onmouseover=function() { moveElement("preview",-200,0,10); } links[2].onmouseover=function() { moveElement("preview",-300,0,10); }}function moveElement(elementID,final_x,final_y,interval){//后面的位置 var elem=document.getElementById(elementID); if (elem.movement){ clearTimeout(elem.movement); } var xpos=parseInt(elem.style.left);//得到坐標 var ypos=parseInt(elem.style.top); if(xpos==final_x&&ypos==final_y) {return true;} if (xpos<final_x){xpos++;} if(xpos>final_x){xpos--;} if (ypos<final_y){ypos++;} if(ypos>final_y){ypos--;} elem.style.left=xpos+"px"; elem.style.top=ypos+"px"; var repeat="moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")"; elem.movement=clearTimeout(repeat,interval);}////////////////////////////////////////////////////////////////////////////////////////////////////////////////運行后瀏覽器F12不報錯但也不運行js的功能只有html結構
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1482 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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