我作了个试验,如下代码正确吗?<html>
<body>
<script language="javascript">
function func(obj)
{
obj.value="ok";
}
</script>
<input id="ForTest">
<script language="javascript">
ForTest.attachEvent('onclick', new Function("func(ForTest);"));
</script>
<input id="xy" onclick="alert(document.all.xy.offsetLeft+'\n'+document.all.xy.offsetTop)" value="位置" type=button>
<div id="xy1">
<input onclick="alert(document.all.xy1.offsetLeft+'\n'+document.all.xy1.offsetTop+'\n')" value="位置" type=button>
</div>
<input onclick="alert(document.all.ForTest.offsetLeft+'\n'+document.all.ForTest.offsetTop+'\n'+document.all.ForTest.clientWidth)" value="位置" type=button></body>
</html>