📜  HTML | DOM MouseEvent screenY 属性

📅  最后修改于: 2021-11-07 09:13:40             🧑  作者: Mango

MouseEvent screenY属性是一个只读属性,用于在触发事件时返回鼠标指针的垂直坐标。

句法 :

event.screenY

返回值:它返回一个数字,以像素为单位表示鼠标指针的垂直坐标。

下面的程序说明了 MouseEvent screenY 属性:
示例:当在元素上单击鼠标按钮时,找出鼠标指针相对于屏幕的水平坐标。



  

    MouseEvent screenY Property in HTML
    

  

  
    

GeeksforGeeks

    

MouseEvent screenY Property

       

      Click somewhere in the paragraph to get       the y(vertical) coordinates of the mouse pointer.   

       

             

输出:

  • 点击按钮前:
  • 点击按钮后:

支持的浏览器:

  • 歌剧
  • IE浏览器
  • 谷歌浏览器
  • 火狐
  • 苹果Safari