<script>
function check()
{
if(this.isEmpty.value == "")
{
document.all.iSEmptyBlank.innerHTML = '<input type="text" name="isEmpty" onBlur="check()"/> can not be empty!';
this.isEmpty.focus();
}
}
</script><div id="iSEmptyBlank"><input type="text" name="isEmpty" onBlur="check()"/></div>

解决方案 »

  1.   

    用层固定在那里,控制输出文本的显示和不显示,这样比较实用
    if(this.isEmpty.value == "")
    {
                “can not be empty!”层.ID.disabled=true;
        this.isEmpty.focus();
    }
             else
             {
               “can not be empty!”层.ID.disabled=false;
             }
      

  2.   

    <script>
    function check(){
    document.all.iSEmptyBlank.innerHTML='';
    if(this.isEmpty.value == ""){
    document.all.iSEmptyBlank.innerHTML = ' can not be empty!';
    this.isEmpty.focus();
    }
    }
    </script><input type="text" name="isEmpty" onBlur="check()"/><div id="iSEmptyBlank"></div>
      

  3.   

    uGain(uGain.org)、ufrshchenw(tchanway):两位的建议我都看了,效果都很好!相比较而言uGain的方法更有重用的价值。所以,我最终采纳了uGain的建议。如果有疑义,也请不吝发言。再次感谢两位的帮助。