Вы находитесь на странице: 1из 3

/****************************************************************/

/*
**
** does not contain single quotes, double space, <, >
*/
/****************************************************************/
function textboxvalidation(strfield)
{
var intct;
var strkey;
var strtext;
strkey=strfield.value;
for (intct = 0; intct < strkey.length; intct++)
{

if (strkey.charat(0)==" ")
{

strtext = strkey.substring(1,strkey.length);
strfield.value = strtext;
}

if(strkey.charat(0) == ".")
{
strtext = strkey.substring(1,strkey.length);
strfield.value = strtext;
}

if (strkey.charat(intct)=="'")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
else if (strkey.charat(intct) == " ")

{
if (strkey.charat(intct -1 ) == " ")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
//checking for sender. if is email id or comfirmemail
then removing sapce.
if(strfield.id == "txtemail" || strfield.id ==
"txtconfirmemail")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
}
else if (strkey.charat(intct)==";")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
else if (strkey.charat(intct)==":")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}

else if (strkey.charat(intct)=="<")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
else if (strkey.charat(intct)==">")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
else if (strkey.charat(intct)=="!" || strkey.charat(intct)== "%"
|| strkey.charat(intct)== "#" || strkey.charat(intct)== "$" ||
strkey.charat(intct)== "^" || strkey.charat(intct)== "(" || strkey.charat(intct)==
")" || strkey.charat(intct)== "*" || strkey.charat(intct)== "&" ||
strkey.charat(intct) == "\\" )
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
else if (strkey.charat(intct)=="+" || strkey.charat(intct)== "=" ||
strkey.charat(intct)== "_" || strkey.charat(intct)== "?" || strkey.charat(intct)==
"'" || strkey.charat(intct)== "," || strkey.charat(intct)== "_" ||
strkey.charat(intct)=='"' || strkey.charat(intct) == ":" || strkey.charat(intct)
== ";" )
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}

else if (strkey.charat(intct) == "@")

{
if (strkey.charat(intct -1 ) == "@")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
}
else if (strkey.charat(intct) == ".")

{
if (strkey.charat(intct -1 ) == ".")
{
strtext = strkey.substring(0,intct);
strtext = strtext + strkey.substring(intct +
1,strkey.length);
strfield.value = strtext;
}
}
}
}

Вам также может понравиться