html代码
- <!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=iso-8859-1" />
- < title > Untitled Document </ title >
- </ head >
- < body >
- < img onmouseover = "LeftOver()" onmouseout = "LeftOut()" onmousedown = "LeftDown()" onmouseup = "LeftUp()" src = "right.gif" width = "13" height = "13" /> left
- < img onmouseover = "RightOver()" onmouseout = "RightOut()" onmousedown = "RightDown()" onmouseup = "RightUp()" src = "left.gif" width = "13" height = "13" /> right
- < DIV id = "scrollBox" style = "Z-INDEX: 100; OVERFLOW: hidden; WIDTH: 490px; POSITION: static; HEIGHT: 170px" >
- < TABLE cellSpacing = 0 cellPadding = 0 width = "100%" border = 0 > < TBODY >
- < TR >
- < TD id = "scrollObject" >
- < img id = "pfxx" src = "DSC08410.JPG" width = "1280" height = "960" />
- </ TD > <!-- logic for material 1 end -->
- < TD id = "scrollObjectMirror" > </ TD >
- </ TR >
- </ TBODY > </ TABLE >
- </ DIV >
- < script src = "scrollpic.js" language = "javascript" > </ script >
- </ body >
- </ html >
scroll.js 代码
- var speed3=10 //??????????
- scrollObjectMirror.innerHTML=scrollObject.innerHTML
- function MarqueeLeft(obj,obj1,obj2,step){
- if (obj2.offsetWidth-obj.scrollLeft<=0) {
- obj.scrollLeft-=obj1.offsetWidth
- }
- else {
- obj.scrollLeft+=step;
- }
- }
- function MarqueeRight(obj,obj1,obj2,step){
- if (obj.scrollLeft<=0) {
- obj.scrollLeft +=obj1.offsetWidth
- }
- else {
- obj.scrollLeft-=step;
- }
- }
- var MyMar1;
- function LeftOut(){clearInterval(MyMar1)}
- function LeftOver(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeLeft(scrollBox, scrollObject, scrollObjectMirror, 1)" ,speed3)}
- function RightOut(){clearInterval(MyMar1)}
- function RightOver(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeRight(scrollBox, scrollObject, scrollObjectMirror, 1)" ,speed3)}
- //οnmοuseοut="LeftOut()" οnmοusedοwn="LeftDown()" οnmοuseup="LeftUp()"
- function LeftUp(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeLeft(scrollBox, scrollObject, scrollObjectMirror, 1)" ,speed3)}
- function LeftDown(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeLeft(scrollBox, scrollObject, scrollObjectMirror, 5)" ,speed3)}
- function RightUp(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeRight(scrollBox, scrollObject, scrollObjectMirror, 1)" ,speed3)}
- function RightDown(){clearInterval(MyMar1);MyMar1=setInterval( "MarqueeRight(scrollBox, scrollObject, scrollObjectMirror, 5)" ,speed3)}