是否可以获取html元素的x和y? [英] Is it possible to get the x and y of an html element ?

查看:113
本文介绍了是否可以获取html元素的x和y?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

是否可以获取html元素的x和y?我尝试使用顶部和左侧执行此操作,但它不起作用.并且我正在做的是将一个元素直接放置在另一个元素下.所以我写道:

Hi all ,

Is it possible to get the x and y of an html element ? i tried doing that with top and left but it is not working.And what i was doing is placing an element under another one directly.So i wrote :

e1.left=e.left;
e1.top=e.top+100;



在javascript代码中.但是放置位置不正确.

那么如何解决呢?

在此先感谢您.



in javascript code.But the placement is not ok.

So how to fix that ?

Thanks in advance.

推荐答案

这可能会对您有所帮助.

http://stackoverflow.com/questions/442404/dynamically-retrieve- html-element-xy-position-with-javascript [ ^ ]
this might help you.

http://stackoverflow.com/questions/442404/dynamically-retrieve-html-element-x-y-position-with-javascript[^]


这篇关于是否可以获取html元素的x和y?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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