开发者

focus problem in mozilla

In my application I am using a text box with onBlur property assigned to a function i cant focus by telling the id in Mozilla the code is as follows

<asp:TextBox ID="txtPassword" AutoCompleteType="Disabled" autocomplete="off" runat="server" MaxLength="25" Width="350px" TextMode="Password" onBlur="return ValidatePassword(this.text);"> </asp:TextBox>

Javascript function

开发者_C百科

function ValidatePassword(element) { element.focus(); }


onblur is a client side function, to get the value of the textbox in client side, use .value not .text.

onBlur="return ValidatePassword(this);"

function ValidatePassword(element) {
    if(element.value.length < 5){
        setTimeout(function(){
            element.focus();
        }, 100);
    }
}


Try changing it to:

    <asp:TextBox ID="txtPassword" AutoCompleteType="Disabled" 
    autocomplete="off" runat="server" 
    MaxLength="25" Width="350px" TextMode="Password" onBlur="return 
    ValidatePassword(document.getelementById('<%=txtPassword.ClientID%>'));"> 
</asp:TextBox>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜