关键的代码是这样的:
<form  name= "tcpip" method="post" action="/goform/form_prtsvrtcpipSet"> 
     这部分是提交表单时要用到的,也就是在当前页面设置值以后,点击“Apply New Settings”后,会显示“reboot the system”<td nowrap><input type="submit" value="Apply New Settings" </td>现在,我希望的是:
       点击“Apply New Settings”时,先弹出一个可以输入用户名和密码的认证对话框,再显示“reboot the system”,该怎么做啊,谢谢了

解决方案 »

  1.   

    随便找了个例子,LZ自己改改吧
    <html> 
    <head> 
    <title>LIGHTBOX EXAMPLE</title> 
    <style> 
    .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%;background-color: #cccccc; z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80); }.white_content { display: none; position: absolute; top: 25%; left: 25%; width: 50%; height: 50%;padding: 16px; border: 16px solid orange; background-color: white; z-index:1002; overflow: auto; }</style> 
    </head> 
    <body> 
    <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">打开</a> 
    <div id="light" class="white_content"> 
        内容
        <a href="javascript:void(0)" onclick="document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"> 
        关闭</a></div> 
    <div id="fade" class="black_overlay"> 
    </div> 
    </body> 
    </html>
      

  2.   

    简单写一下代码,基本原理就是这样的,需要你结合你的项目进行完善:
    <style><!--
    #auth_dialog{display:none;position:absolute;width:300px;height:200px;border:1px #ccc solid;left:450px;top:200px;}/*弹出框的样式,简单定义了下,需要你完善*/
    --></style>
    <form  name= "tcpip" method="post" action="/goform/form_prtsvrtcpipSet">
    <input type="submit" value="Apply New Settings" onclick="return ShowAuthDialog();"/>
    </form>
    <div id=auth_dialog>
    <p>用户名:<input type=text id=userAccount name=userAccount/></p>
    <p>密码:<input type=password id=userPwd name=userPwd/></p>
    <p><input type=button value="登 入" onclick="Auth();" /></p>
    </div>
    <script type=text/javascript>   function ShowAuthDialog(){
          document.getElementById('auth_dialog').style.display = 'block';
          return false;//这里返回false可以让form不被提交,你也可以把submit改为button
       }   function Auth(){
         //使用Ajax处理登入过程
          if(success)//返回是否登入成功
            return true;
         return false;
       }
    </script>
      

  3.   

    就是prompt的一种,只不过自己做得贴近需求些。用div做。