To move the mouse over a small chart to display a large image, I used the mouse event to create a layer to display the large image. Of course, we 'd better get the XY coordinates before.
Returns the X and Y coordinates of the current mouse. Function selfxy (){
VaR yscrolltop;
VaR xscrollleft;
If (self. pageyoffset | self. pagexoffset ){
Yscrolltop = self. pageyoffset;
Xscrollleft = self. pagexoffset;
} Else if (document.doc umentelement & document.doc umentelement. scrolltop | document.doc umentelement. scrollleft) {// Explorer 6 strict
Yscrolltop = document.doc umentelement. scrolltop;
Xscrollleft = document.doc umentelement. scrollleft;
} Else if (document. Body) {// all other referers
Yscrolltop = Document. Body. scrolltop;
Xscrollleft = Document. Body. scrollleft;
}
Arraypagescroll = new array (xscrollleft + event. clientx, yscrolltop + event. clienty)
Return arraypagescroll;
}
Appendix: control attributes of mouse and object coordinates
Offsettop
Obtains the top position of an object relative to the layout or the parent coordinate specified by the offsetparent attribute.
Offsetleft
Obtains the left-side position of an object relative to the layout or the parent coordinate specified by the offsetparent attribute.
Offsetheight
Obtains the height of an object relative to the layout or the parent coordinate specified by the parent coordinate offsetparent attribute.
IE and opera think offsetheight = clientheight + scroll bar + border.
NS and FF hold that offsetheight is the actual height of the webpage content, which can be smaller than clientheight.
Offsetwidth
Obtains the width of an object relative to the layout or the parent coordinate specified by the parent coordinate offsetparent attribute.
Offsetparent
Gets the reference of the container Object Defining the offsettop and offsetleft attributes.
Clientheight
Obtains the height of an object, without calculating any margin, border, scroll bar, or padding that may be applied to the object.
Everyone has no objection to clientheight and thinks it is the height of the visible area of the content, that is, the height of the area where the content can be viewed in the browser of the page, generally, the area below the last toolbar to above the status bar is irrelevant to the page content.
Clientleft
Obtain the distance between the offsetleft attribute and the actual left side of the customer region.
Clienttop
Obtain the distance between the offsettop attribute and the actual top of the customer region.
Clientwidth
Obtains the width of an object. It does not calculate any margin, border, scroll bar, or padding that may be applied to the object.
Scroll attributes
Scroll
Set or obtain whether to disable scrolling.
Scrollheight
Obtains the scroll height of an object.
Scrollleft
Set or obtain the distance between the left-side border of the object and the leftmost side of the currently visible content in the window.
Scrolltop
Sets or obtains the distance between the top of the object and the top of the visible content in the window.
Scrollwidth
Obtains the scroll width of an object.
Event Properties
X
Sets or obtains the X-pixel coordinates of the cursor position relative to the parent document.
Screenx
Set or obtain the X coordinate of the cursor position relative to the user's screen
Offsetx
Set or obtain the X coordinate of the object with the cursor position relative to the trigger event.
Clientx
Sets or obtains the X coordinate of the mouse pointer position relative to the client area of the window. The client area does not include the control and scroll bar of the window.