function validatespecailchars()
{
var txtbox = document.getElementById('<%=txtsearch.ClientID %>').value;
var str="<";
var str1=">";
var str2="--";
var str3=";";
var str4="'";
if((txtbox.indexOf(str)>=0)||(txtbox.indexOf(str1)>=0)||(txtbox.indexOf(str2)>=0)|| (txtbox.indexOf(str3)>=0)||(txtbox.indexOf(str4)>=0))
{
alert('Special Characters are not Allowed.');
// you can focus here that particular control
}
}
{
var txtbox = document.getElementById('<%=txtsearch.ClientID %>').value;
var str="<";
var str1=">";
var str2="--";
var str3=";";
var str4="'";
if((txtbox.indexOf(str)>=0)||(txtbox.indexOf(str1)>=0)||(txtbox.indexOf(str2)>=0)|| (txtbox.indexOf(str3)>=0)||(txtbox.indexOf(str4)>=0))
{
alert('Special Characters are not Allowed.');
// you can focus here that particular control
}
}
No comments:
Post a Comment