网页开发如何弹出式文本(密码)输入框

浏览器打开 Page1.jsp,单击按钮,弹出输入框,输入完毕,单击确定,Page1.jps内的输入框出现相应录入信息。

 

password_box.jsp 对话框页面代码

------------------------------------------------------------

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <script lang="javascript">
      function OnClose(check)
      {
        if(check == true)
        {
          var value = document.getElementById("password").value;
          window.returnValue = value;
        }
        window.close();
      }
    </script>
  </head>
  <body scroll="no">
    <div style="width:200px; left:10px; top:20px; position:relative; height:55px">

      <div  style="width:208px; left:0px; top:0px; position:absolute; height:24px">
        <font class="big1_text">输入审核密码</font>
      </div>

      <div style="width:auto; left:114px; top:0px; position:absolute; height:20px">
        <input type="text" id="password" size="12" maxlength="20"/>
      </div>

      <div style="width:60px; left:170px; top:30px; position:relative; height:20px">
        <input type="button" value="确认" οnclick="OnClose(true)" />
      </div>

    </div>
  </body>
</html>

 

-------------------------------------------------------------------------------------------

Page1.jsp 调用页面代码

---------------------------------------------------------------------------------------

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <script language="javascript" type="text/javascript">    
      function ShowPasswordBox()
      {

        // 显示密码输入框
        var pwd =
window.showModalDialog("password_box.jsp","box","dialogHeight: 100px; dialogWidth:200px; edge: Sunken; center: Yes; resizable: No; status: No;");
        if(pwd)
        {

         
// 设置显示内容为输入框中的内容

          document.getElementById("showpwd").value = pwd;
        }       
      }
    </script>
  </head>
  <body>
    <input type="button" value="button" οnclick="ShowPasswordBox()"/>
    <input type="text" name="showpwd" id="showpwd" />
  </body>
</html>

 

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值