图片左右滚动代码

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

_DivLeft = obj1.left; _DivRight = obj1.right; _AllDivWidth = _DivRight - _DivLeft; } else if(document.getBoxObjectFor) { //FireFox obj1 = document.getBoxObjectFor(obj); var borderwidth = (obj.style.borderLeftWidth != null && obj.style.borderLeftWidth != "") ? parseInt(obj.style.borderLeftWidth) : 0; _DivLeft = parseInt(obj1.x) - parseInt(borderwidth); _AllDivWidth = Cut_Px(obj.style.width); _DivRight = _DivLeft + _AllDivWidth; } else { //Other Browser(Opera) _DivLeft = obj.offsetLeft; _AllDivWidth = Cut_Px(obj.style.width); var parent = obj.offsetParent; if(parent != obj) { while (parent) { _DivLeft += parent.offsetLeft; parent = parent.offsetParent; } } _DivRight = _DivLeft + _AllDivWidth; } var pos1,pos2; pos1 = parseInt(_AllDivWidth * 0.4) + _DivLeft; pos2 = parseInt(_AllDivWidth * 0.6) + _DivLeft; if(_MousePX > _DivLeft && _MousePX < _DivRight) { if(_MousePX > _DivLeft && _MousePX < pos1)//Move left {
=
பைடு நூலகம்
</SCRIPT> <div style="width:100% ;text-align:left; left:200px; top:200px;"> position:absolute;
<DIV id="demo" style="OVERFLOW: hidden; WIDTH: 800px; COLOR: #ffffff; HEIGHT: 200px" onmousemove="MoveDiv(event);" onmouseout="MoveOutDiv();"> <div id="demo1" style="width:100%;"> <TABLE cellSpacing=0 cellPadding=0> <TBODY> <TR vAlign=top> <TD vAlign=top noWrap> <DIV align=right> <img src="images/compamy-1.jpg" width="342" height="200"> <img src="images/company-2.jpg" width="309" height="200"> <img src="images/company-3.jpg" width="286" height="200"> <img src="images/company-4.jpg" width="302" height="200"> <img src="images/company-5.jpg" width="306" height="200"> <img src="images/company-6.jpg" width="290" height="200"> <img src="images/company-7.jpg" width="298" height="200"> <img src="images/company-8.jpg" width="305" height="200"> <img src="images/company-9.jpg" width="291" height="200"> <img src="images/company-10.jpg" width="309" height="200"> <img src="images/company-11.jpg" width="308" height="200"> <img src="images/company-12.jpg" width="290" height="200"> </DIV></TD></TR></TBODY></TABLE> </TD> <TD width="0"> <div id="demo2" style="width:100%;"></div> </TD> </TR></TBODY></TABLE> </DIV>
r_left(); } else if(_MousePX < _DivRight && _MousePX > pos2)//Move right { r_right(); } if(_MousePX > pos1 && _MousePX < pos2)//Stop { onmouseoverMy(); MyMar=null; }else if(_MousePX < pos1 || _MousePX > pos2) { if(MyMar==null) { MyMar=setInterval(Marquee,speed); } } } } function Cut_Px(cswidth) { cswidth = cswidth.toLowerCase(); if(cswidth.indexOf("px") != -1) { cswidth.replace("px",""); cswidth = parseInt(cswidth); } return cswidth; } function MoveOutDiv() { if(MyMar == null) { MyMar=setInterval(Marquee,speed); } }
图片左右滚动代码.txt28生活是一位睿智的长者,生活是一位博学的老 师,它常常春风化雨,润物无声地为我们指点迷津,给我们人生的启 迪。不要吝惜自己的爱,敞开自己的胸怀,多多给予,你会发现,你也 已经沐浴在了爱河里。<SCRIPT> var dir=1;//每步移动像素,大=快 var speed=10;//循环周期(毫秒)大=慢 var MyMar=null; function Marquee(){//正常移动 var demo = document.getElementById("demo"); var demo2 = document.getElementById("demo2"); if (dir>0 && (demo2.offsetWidth-demo.scrollLeft)<=0) { demo.scrollLeft=0; } if (dir<0 &&(demo.scrollLeft<=0)) { demo.scrollLeft=demo2.offsetWidth; } demo.scrollLeft+=dir; } function onmouseoverMy() { window.clearInterval(MyMar); }//暂停移动 function onmouseoutMy() { MyMar=setInterval(Marquee,speed); }//继续移动 function r_left() { if (dir==-1) dir=1; }//换向左移 function r_right() { if (dir==1) dir=-1; }//换向右移 function IsIE()
{ var browser=navigator.appName if ((browser=="Netscape")) { return false; } else if(browser=="Microsoft Internet Explorer") { return true; } else { return null; } } var _IsIE = IsIE(); var _MousePX = 0; var _MousePY = 0; var _DivLeft = 0; var _DivRight = 0; var _AllDivWidth = 0; var _AllDivHeight = 0; function MoveDiv(e){ var obj = document.getElementById("demo"); _MousePX = _IsIE ? (document.body.scrollLeft + event.clientX) : e.pageX; _MousePY = _IsIE ? (document.body.scrollTop + event.clientY) : e.pageY; //Opera Browser Can Support ''window.event'' and ''e.pageX'' var obj1 = null; if(obj.getBoundingClientRect) { //IE obj1 = document.getElementById("demo").getBoundingClientRect();
</div><script type="text/javascript"> document.getElementById("demo2").innerHTML document.getElementById("demo1").innerHTML; MyMar=setInterval(Marquee,speed); </script>
相关文档
最新文档