Using JS to display the picture on the left and right arrows Page code, preview effect Web site: http://www.keleyi.com/keleyi/phtml/picnext/
This example uses the onmousemove event of javascript. The onmousemove event occurs when the mouse pointer moves.
Syntax
Onmousemove = "sometriccriptcode"
Sometriccriptcode is a required parameter. Specifies the JavaScript code executed when the event occurs.
Below is the core code(For the complete code, view the source code on the results page ):
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Function KeleyiImgNext (bigimg ){
Var lefturl = "01.html ";
Var righturl = "03.html ";
Var imgurl = righturl;
Var width = bigimg. width;
Var height = bigimg. height;
Bigimg. onmousedown = bigimg. onmousemove = function (){
If (event. offsetX <width/2 ){
Imgurl = lefturl;
If (imgurl! = "#")
Bigimg. style. cursor = 'url (images/arr_left.cur), auto ';
Else
Bigimg. style. cursor = 'default ';
} Else {
Imgurl = righturl;
If (imgurl! = '#')
Bigimg. style. cursor = 'url (images/arr_right.cur), auto ';
Else
Bigimg. style. cursor = 'default ';
}
}
Bigimg. onmouseup = function (){
If (imgurl! = '#')
Top. location = imgurl;
}
}
</Script>