如何得到一个标签再浏览器里的left值,超级简单,顶者有分! 什么是left数值?取得里面td的值用a.innerText 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面程序仅供参考!<script language="javascript">function a(){alert(document.all.dee.id);}</script>...<a name="dee" id="dee"></a> left就是<A id="a">标签距离浏览器左边的距离 //得到控件的绝对位置function getPos(cell){ var pos = new Array(); var t=cell.offsetTop; var l=cell.offsetLeft; while(cell=cell.offsetParent) { t+=cell.offsetTop; l+=cell.offsetLeft; } pos[0] = t; pos[1] = l; return pos;}alert(getPos(document.all.a)[0])alert(getPos(document.all.a)[1]) function GetDefineX(ObjectID){ var iPositionX=ObjectID.offsetLeft; while(ObjectID=ObjectID.offsetParent) { iPositionX+=ObjectID.offsetLeft; } return iPositionX;}function GetDefineY(ObjectID){ var iPositionY=ObjectID.offsetTop; while(ObjectID=ObjectID.offsetParent) { iPositionY+=ObjectID.offsetTop; } return iPositionY;} ligerUI 界面设计 javascript怎样有一个公共缓存区 javascript对象使用的问题 EXT的XMLReader的问题 html中的HIDDEN到底是做什么用的??? <select><option>问题~~~~~~~~~~~~~~ 在线等待~~~~~~~~~~ 在iframe的父窗口中怎样知道iframe页面刷新了。 急需帮助!!!如何向动态产生的<type=file>中赋初值?期待中... 请问JS如何将一个数取整,非常急? 字符串对象的格式方法疑问 动态生成页面控件? 关于textarea输入区如何记录换行?在线等,解决就结
function a(){
alert(document.all.dee.id);
}
</script>
...<a name="dee" id="dee"></a>
function getPos(cell)
{
var pos = new Array();
var t=cell.offsetTop;
var l=cell.offsetLeft;
while(cell=cell.offsetParent)
{
t+=cell.offsetTop;
l+=cell.offsetLeft;
}
pos[0] = t;
pos[1] = l;
return pos;
}alert(getPos(document.all.a)[0])
alert(getPos(document.all.a)[1])
{
var iPositionX=ObjectID.offsetLeft;
while(ObjectID=ObjectID.offsetParent)
{
iPositionX+=ObjectID.offsetLeft;
}
return iPositionX;
}
function GetDefineY(ObjectID)
{
var iPositionY=ObjectID.offsetTop;
while(ObjectID=ObjectID.offsetParent)
{
iPositionY+=ObjectID.offsetTop;
}
return iPositionY;
}