How to set default value in password textbox

<script type="text/javascript">

    function ClearText(txt) {
        if (txt.defaultValue == txt.value) txt.value = "";
if (txt.defaultValue == "Password") {
            txt.type = 'password';
        }
    }
    function ResetText(txt) {
        if (txt.value == "") {
            txt.value = txt.defaultValue;
            txt.type = 'text';
        }
    }

</script>

<asp:TextBox ID="txtPassword" Height="43px" runat="server" onclick="this.value=''; this.type='password';" Text="Password" OnFocus="ClearText(this)" onfocusout="ResetText(this)" ForeColor="#333333" ></asp:TextBox>


No comments:

Post a Comment