<input type="button" value="使文本框1获得焦点" onclick="show('2.htm')"/>
<input type="text" id="text1" >
<input type="text" id="text2">
<SCRIPT LANGUAGE="JavaScript">
<!--
function show(url)
{
document.getElementById("text1").onblur=text1_onblur;
document.getElementById("text1").value=url;
document.getElementById("text1").focus();
}
function text1_onblur()
{
alert("失焦点后,再次获得焦点");
window.setTimeout( function(){ document.getElementById("text1").focus(); }, 0);
//document.getElementById("text1").focus();//把这句换为上面那句就可以了
}
//-->
</SCRIPT>
<input type="text" id="text1" >
<input type="text" id="text2">
<SCRIPT LANGUAGE="JavaScript">
<!--
function show(url)
{
document.getElementById("text1").onblur=text1_onblur;
document.getElementById("text1").value=url;
document.getElementById("text1").focus();
}
function text1_onblur()
{
alert("失焦点后,再次获得焦点");
window.setTimeout( function(){ document.getElementById("text1").focus(); }, 0);
//document.getElementById("text1").focus();//把这句换为上面那句就可以了
}
//-->
</SCRIPT>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货