<script type="text/javascript">
var obj;
function test()
{
if (obj) getpos(obj);
}function getpos(obj)
{
    obj.focus();
    var r = document.selection.createRange();
    r.text = prompt('请输入内容:');
}</script><input type=text name=a size=200 value=edit1 onfocus="obj=this"><br/>
<input type=text name=b size=200 value=edit2 onfocus="obj=this"><br/>
<input type=button value="abcd" onclick="test();">