chandu gummadi

chandu gummadi

  • NA
  • 67
  • 73.4k

Asp.net Javascript for validations

Mar 18 2013 1:14 AM
hi friend iam using javascripts for textbox validations.

<script type="text/javascript" >
        function validations()
        {      
        var ar = new Array("--", "=", ";--", "/*", "*/", "@@", "@", ".js", "insert", "delete", "select", ".exe", ".sql", "xp_", "dbcc", "<script>", "script");
        var t = document.getElementById('txtdeptdesc').value;       
        var i = ar.length;      
        for (var p = 0; p < i; p++)
         {      
           if(t ==  ar[p])
           {
           alert("enter valid username");
           t = "";
           break;
           }
         }

        }
    </script>
<asp:TextBox ID="txtdeptdesc" runat="server" onblur="validations()"></asp:TextBox>

iam writting like this but iam not geeting alert message.

please help me

Answers (2)