var iChars = "!@#$%^&*()+=-[]';,./{}|":<>?";
for (var i = 0; i < document.formname.fieldname.value.length; i++) {
if (iChars.indexOf(document.formname.fieldname.value.charAt(i)) != -1) {
alert ("Your username has special characters.
These are not allowed.
Please remove them and try again.");
return false;
}
}