clientY ʼþÊôÐÔ
¶¨ÒåºÍÓ÷¨
clientY ʼþÊôÐÔ·µ»Øµ±Ê¼þ±»´¥·¢Ê±Êó±êÖ¸ÕëÏò¶ÔÓÚä¯ÀÀÆ÷Ò³Ãæ£¨¿Í»§Çø£©µÄ´¹Ö±×ø±ê¡£
¿Í»§ÇøÖ¸µÄÊǵ±Ç°´°¿Ú¡£
Óï·¨
event.clientY
ÌáʾºÍ×¢ÊÍ
×¢ÊÍ£º×¢Ò⣬¸Ã×ø±ê²»¿¼ÂÇÎĵµµÄ¹ö¶¯¡£Èç¹ûʼþ·¢ÉúÔÚ´°¿ÚµÄ¶¥²¿£¬ÎÞÂÛÎĵµ¹öÁ˶àÔ¶£¬clientY µÄÖµ¶¼ÊÇ 0¡£µ«ÊÇ£¬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
- clientY
- ÏÔʾÊó±êÖ¸ÕëµÄ×ø±ê¡£