clientX ʼþÊôÐÔ
¶¨ÒåºÍÓ÷¨
clientX ʼþÊôÐÔ·µ»Øµ±Ê¼þ±»´¥·¢Ê±Êó±êÖ¸ÕëÏò¶ÔÓÚä¯ÀÀÆ÷Ò³Ãæ£¨»ò¿Í»§Çø£©µÄË®Æ½×ø±ê¡£
¿Í»§ÇøÖ¸µÄÊǵ±Ç°´°¿Ú¡£
Óï·¨
event.clientX
ÌáʾºÍ×¢ÊÍ
×¢ÊÍ£º2 ¼¶ DOM ûÓÐÌṩ°Ñ´°¿Ú×ø±êת»»ÎªÎĵµ×ø±êµÄ±ê×¼·½·¨¡£ÔÚ IE ÒÔÍâµÄä¯ÀÀÆ÷£¬Ê¹Óà window.pageXOffset ºÍ window.pageYOffset ¼´¿É¡£
ʵÀý
ÏÂÃæµÄÀý×Ó¿ÉÏÔʾ³öʼþ·¢ÉúʱÊó±êÖ¸ÕëµÄ×ø±ê£º
<html> <head> <script type="text/javascript"> function show_coords(event) { x=event.clientX
y=event.clientY
alert("X coords: " + x + ", Y coords: " + y) } </script> </head> <body onmousedown="show_coords(event)"> <p>Click in the document. An alert box will alert the x and y coordinates of the mouse pointer.</p> </body> </html>
TIY
- clientX
- ÏÔʾÊó±êÖ¸ÕëµÄ×ø±ê¡£