function Point(iX, iY){
this.x = iX;
this.y = iY;
}function fGetXY(aTag){
var oTmp = aTag;
var pt = new Point(0,0);
do {
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
} while(oTmp.tagName!="BODY");
return pt;
}
this.x = iX;
this.y = iY;
}function fGetXY(aTag){
var oTmp = aTag;
var pt = new Point(0,0);
do {
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
} while(oTmp.tagName!="BODY");
return pt;
}
解决方案 »
- IE8上传图片无法预览问题~~
- 求类似RadEditor能edit full HTML的Web Editor
- 加速 减速!!!!!!!
- 帮我看看这段代码为什么不起作用
- 在没提交表单的情况下 如何动态获取表单的值呢?
- js怎样 获得当前选中位置元素的 html格式?
- Extjs实现如图的布局-table布局下filedlable不显示
- 怎么得到动态添加的控件
- 如何引用*.js文件
- 如何用JS给textarea赋值字符串,其中实现字符换行,用\n不行呀?
- 请教:在dramweaver8里边不能点选"设计"界面的 文本框和按钮,代码在内.请问怎么解决?
- js 语法中input 中 name=id的问题
--------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function Point(iX, iY){
this.x = iX;
this.y = iY;
}function fGetXY(aTag){ //传入目标对象
var oTmp = aTag;
var pt = new Point(0,0);
do {
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
} while(oTmp.tagName!="BODY");
return pt;
}function showPosition(obj){
var pt=fGetXY(obj);
alert('X坐标为:'+pt.x+'\nY坐标为:'+pt.y);
}
</script>
</head><body>
<table width="100%" border="0" cellspacing="50" cellpadding="1">
<tr>
<td width="33%"><input name="button" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td width="34%"><input name="button2" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td width="33%"><input name="button3" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
</tr>
<tr>
<td><input name="button7" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td><input name="button6" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td><input name="button4" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
</tr>
<tr>
<td><input name="button8" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td><input name="button62" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
<td><input name="button5" type="button" value="看看我的坐标" onclick="showPosition(this)"/></td>
</tr>
</table>
</body>
</html>
调用我知道.但showPosition(obj)中的obj如何写