对象的屏幕坐标 [英] Screen coordinates of object

查看:103
本文介绍了对象的屏幕坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!


我需要一个脚本,它可以计算给定对象(例如textbox或div)的屏幕坐标。通过屏幕坐标我的意思是偏离屏幕的左上角(不是框架或浏览器窗口)。


提前谢谢。

解决方案

使用screenX / screenY属性。


如果HTML自身呈现,你将无法获得。但是如果你已经通过CSS(或javascript)设置了元素的位置,左边和顶部,那么你就能够将x和y坐标检索为

展开 | 选择 | Wrap | 行号



使用screenX / screenY属性。



这是一个非常古老的帖子! ...... :d


Hi everybody!

I need a script, which calculates screen coordinates of given object (e.g. textbox or div). By "screen coordinates" I mean offset from upper left corner of the screen (not frame or browser window).

Thanks in advance.

解决方案

Use the screenX/screenY properties.


You won''t be able to get that if the HTML is rendered itself. But if you have set the position, and left and top of the elements by CSS (or javascript), only then you would be able to retrieve the x and y coordinates as

Expand|Select|Wrap|Line Numbers


Use the screenX/screenY properties.

And that was a really old post! ...:D


这篇关于对象的屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆