<script type="text/javascript">
//<![CDATA[
onload=function(){
var o=document.getElementById('MsgBox7');
defaultStatus=o.offsetLeft+' '+o.offsetTop+' '+
o.offsetWidth+' '+o.offsetTop+' '+o.offsetParent.nodeName
}
//]]>
</script>
<a id="MsgBox7" href="">点击查看</a>
//<![CDATA[
onload=function(){
var o=document.getElementById('MsgBox7');
defaultStatus=o.offsetLeft+' '+o.offsetTop+' '+
o.offsetWidth+' '+o.offsetTop+' '+o.offsetParent.nodeName
}
//]]>
</script>
<a id="MsgBox7" href="">点击查看</a>
解决方案 »
- 求助jsp中添加打印方法不显示页眉页脚
- Delphi automation object 创建的ocx 如何开事件
- js子窗口父窗口问题
- 如何用jquery实现当鼠标移出层时层消失
- 怎么在框架里访问父页面的控件?
- 怎样用javascript实现打开网页就用播放软件播放一个视频文件,同时关闭该页面,不要在页面播放那种
- 是我的网络问题还是csdn的问题,慢晕了,我只不过想来问个问题
- 发现IE未公开秘密 -- 真正意义上的全屏!!!
- 请教:netscape中调用<input type="file" name="aa">的方法
- 急、急啊!请各位大虾快快帮助解决!!!!
- 为空不是对象
- 急!请教各位高手IE5,IE6,IE7的区别!
---------------------------------
getBoundingClientRect Method--------------------------------------------------------------------------------Retrieves an object that specifies the bounds of a collection of TextRectangle objects. SyntaxoRect = object.getBoundingClientRect()
Return ValueReturns a TextRectangle object. Each rectangle has four integer properties (top, left, right, and bottom) that represent a coordinate of the rectangle, in pixels.ResThis method retrieves an object that exposes the left, top, right, and bottom coordinates of the union of rectangles relative to the client's upper-left corner. In Microsoft Internet Explorer 5, the window's upper-left is at 2,2 (pixels) with respect to the true client.
但改一下就更直观了:<a id="MsgBox7" href="javascript:dp();">点击查看本链接元素的位置</a>
<script type="text/javascript">
function dp(){
var o=document.getElementById('MsgBox7');
alert('Left:' + o.offsetLeft+' Top:'+o.offsetTop+' Width:'+ o.offsetWidth+' Height:'+o.offsetHeight+' NodeName:'+o.offsetParent.nodeName);
}
</script>