<Div id = "parent"
Style = "cursor: hand; overflow: hidden; width: 800px; Height: 50px">
<Div id = "child_a" style = "float: Left; white-space: nowrap;">
|
</Div>
</Div>
<Input type = "button" value = "stop" onclick = "AA. Stop ()">
<Input type = "button" value = "Left" onclick = "AA. Left ()">
<Input type = "button" value = "right" onclick = "AA. Right ()">
// JS controls image Movement (there is no blank left or right movement of Marquee)
<SCRIPT type = "text/JavaScript">
Function marque () {// JS encapsulation class
Marque. Prototype. Parent = Document. getelementbyid ("parent ");
Marque. Prototype. childa = Document. getelementbyid ("child_a ");
Marque. Prototype. parentwidth = marque. Prototype. Parent. offsetwidth;
Marque. Prototype. Count = 2;
Marque. Prototype. childa. innerhtml = marque. Prototype. childa. innerhtml + "" + marque. Prototype. childa. innerhtml;
While (marque. Prototype. Parent. scrollwidth <= marque. Prototype. parentwidth ){
Marque. Prototype. Count * = 2;
Marque. Prototype. childa. innerhtml = marque. Prototype. childa. innerhtml + "" + marque. Prototype. childa. innerhtml;
}
Marque. Prototype. speed = 10;
Marque. Prototype. Flag = "stop ";
Marque. Prototype. marqueeleft = function (){
If (marque. Prototype. childa. offsetwidth/marque. Prototype. Count-marque. Prototype. Parent. scrollleft <= 0 ){
Marque. Prototype. Parent. scrollleft-= marque. Prototype. childa. offsetwidth/marque. Prototype. count;
} Else {
Marque. Prototype. Parent. scrollleft ++;
}
};
Marque. Prototype. marqueeright = function (){
If (marque. Prototype. Parent. scrollleft <= 0 ){
Marque. Prototype. Parent. scrollleft = marque. Prototype. Parent. scrollleft + marque. Prototype. childa. offsetwidth/marque. Prototype. count;
} Else {
Marque. Prototype. Parent. scrollleft --;
}
};
Marque. Prototype. myleft = "";
Marque. Prototype. myright = "";
Marque. Prototype. Stop = function (){
If (marque. Prototype. Flag = "stop "){
Return true;
}
If (marque. Prototype. Flag = "right "){
Clearinterval (marque. Prototype. myright );
Marque. Prototype. Flag = "stop ";
Return true;
}
If (marque. Prototype. Flag = "Left "){
Clearinterval (marque. Prototype. myleft );
Marque. Prototype. Flag = "stop ";
Return true;
}
};
Marque. Prototype. Left = function (){
If (marque. Prototype. Flag = "stop "){
Marque. Prototype. myleft = setinterval (marque. Prototype. marqueeleft, marque. Prototype. Speed );
Marque. Prototype. Flag = "Left ";
Return true;
}
If (marque. Prototype. Flag = "right "){
Clearinterval (marque. Prototype. myright );
Marque. Prototype. myleft = setinterval (marque. Prototype. marqueeleft, marque. Prototype. Speed );
Marque. Prototype. Flag = "Left ";
Return true;
}
If (marque. Prototype. Flag = "Left "){
Return true;
}
};
Marque. Prototype. Right = function (){
If (marque. Prototype. Flag = "stop "){
Marque. Prototype. myright = setinterval (marque. Prototype. marqueeright, marque. Prototype. Speed );
Marque. Prototype. Flag = "right ";
Return true;
}
If (marque. Prototype. Flag = "right "){
Return true;
}
If (marque. Prototype. Flag = "Left "){
Clearinterval (marque. Prototype. myleft );
Marque. Prototype. myright = setinterval (marque. Prototype. marqueeright, marque. Prototype. Speed );
Marque. Prototype. Flag = "right ";
Return true;
}
};
}
VaR AA = new marque ();
VaR AA = new marque ();
</SCRIPT>