关于怎么取控件的XY坐标!
<script>
function showXY(obj){
alert( "X: "+obj.style.top+ "\n\nY: "+obj.style.left)
}
</script>
<input type= "text " onClick= "showXY(this) "> <input type= "text " onClick= "showXY(this) "> <br>
<input type= "text " onClick= "showXY(this) ">
------解决方案--------------------
<script>
function showXY(obj){
alert( "X: "+obj.offsetTop+ "\n\nY: "+obj.offsetLeft);
}
</script>
<input type= "text " onClick= "showXY(this) "> <input type= "text " onClick= "showXY(this) "> <br>
<input type= "text " onClick= "showXY(this) ">
查询谷 - www.chaxungu.com
关于如何取控件的XY坐标
编辑:chaxungu时间:2022-10-02 23:20:26分类:web开发