这样不死循环才怪,为什么这么做

解决方案 »

  1.   

    <html>
    <script>var f=null</script>
    <body bgcolor="#eeeeee">
    <form name="form1" method="post" action="">
      <input type="text" name="test1" onfocus="if(f==this)f=null" onblur="if(f!=null)return;if(value==''){alert('Empty?');f=this;f.focus();}">
      <input type="text" name="test2" onfocus="if(f==this)f=null" onblur="if(f!=null)return;if(value==''){alert('Empty?');f=this;f.focus();}">
    </form>
    </body>
    </html>