<script>
function test()
{var pwd='123456';
if (window.prompt("请输入你的密码!",'')==pwd)
{
window.location="http://www.csdn.net";
}else
{
document.all.divName.style.display='';
 TimeID=setTimeout("clearT()",2000);
}
}function clearT()
{
clearTimeout(TimeID);
document.all.divName.style.display='none';
}
</script><a  href="javascript:test();">测试</a>
<div id=divName style="display:none">密码不正确</div>

解决方案 »

  1.   

    <html><head><title>1111111111111111111111111</title>
    <script>
    function check()
    {
      var pw=prompt("请输入密码","")
      if(pw=="123")
      {
         window.open("www.sina.com.cn","")
      }
      else
      {
         error_win=window.open("error.htm","","height=200,width=200")
         setTimeout("error_win.close()",2000)
         
      }
    }
    </script>
    </head><body><p><a href="javascript:void(0)" onclick="check()" >1111111111111111111111111</a></p></body></html>
      

  2.   

    href="javascript:void(0)" 是什么意思呢?
    “密码”二字能否变成红色?且“密码”二字要单独成行,行的吗?