面朝大海,春暖华开

focus on scientific computue, 3dgis, spatial database
专注于科学计算、GIS空间分析

 

ajax学习笔记一:动态更改div位置

a small program ,in order to update the the position of a div use javascrpt , simulate to the tooltip.
just for memo

function Button1_onclick(elem) 
{
var offsetx = elem["offsetLeft"];
var offsety = elem["offsetTop"];

while(elem)
{
offsetx 
+= elem["offsetLeft"];
offsety 
+= elem["offsetTop"];
elem 
= elem.offsetParent;
    
}
document.getElementById(
"tooltip").style.left=offsetx+"px";
document.getElementById(
"tooltip").style.top=offsety+"px";
}

technical support: http://xiexiaokui.cnblogs.com

posted on 2006-11-06 21:57  风过 无痕  阅读(1217)  评论(0编辑  收藏  举报

导航

向日葵支付宝收钱码