<Script LANGUAGE = "JavaScript">
Function check (inputStr ){
If (typeof (inputStr )! = "String "){
Return inputStr;
}
Var tmpValue = inputStr; // search for special characters in strings below www.2cto.com. If yes, replace them ""
While (tmpValue. indexOf (';')>-1 ){
TmpValue = tmpValue. replace (';','');
}
While (tmpValue. indexOf ('<')>-1 ){
TmpValue = tmpValue. replace ('<','');
}
While (tmpValue. indexOf ('>')>-1 ){
TmpValue = tmpValue. replace ('> ','');
}
While (tmpValue. indexOf ('--')>-1 ){
TmpValue = tmpValue. replace ('--','');
}
While (tmpValue. indexOf (",")>-1 ){
TmpValue = tmpValue. replace (",","");
}
While (tmpValue. indexOf ("'")>-1 ){
TmpValue = tmpValue. replace ("'","");
}
While (tmpValue. indexOf ("? ")>-1 ){
TmpValue = tmpValue. replace ("? ","");
}
Document. getElementById ("txt1"). value = tmpValue;
// Re-display the changed variable
}
</Script>