我是用控件做的,想采用隐藏文本框搭配js方法做,将密码传到隐藏的文本框中,再读取该框中保存的密码,如下代码中的function pwd()方法该如何写呢? 
<head runat="server"> 
    <title>测试 </title> 
</head> <script language="javascript"> 
    function pwd() 
    { 
        
    } 
</script> <body> 
    <form id="form1" runat="server"> 
    <div> 
    
        <asp:TextBox ID="TextBox1" runat="server" TextMode="Password"> </asp:TextBox> 
    
    </div> 
    <p> 
        <asp:TextBox ID="TextBox2" runat="server" Visible="False" /> 
    </p> 
    <p> 
        <asp:Button ID="Button1" runat="server" Text="Button" Onclick="pwd()"> </asp:Button> 
    </p> 
    </form> 
</body>

解决方案 »

  1.   

    顶niudinglong,不过除非密码是加密了的,
      

  2.   

    try:<script language="javascript"> 
    function pwd() { 
    window.name=document.getElementById("TextBox1").value

    onload=function(){
    if(window.name){alert(window.name);document.getElementById("TextBox1").value=window.name}
    }
    </script> <body> 
        <form id="form1" runat="server"> 
        <div> 
            <input ID="TextBox1" type=password>  
        </div> 
        <p> 
            <input ID="Button1"  type=button  value="Button" Onclick="pwd()"> 
        </p> 
        </form> 
    </body>