function clean(e){
var textfield = document.getElementById(e);
var regex = /[^a-z 1-9 ,.!?-`'"()\r\n ]/gi;
var wrongWords = new Array("can't", "I", "won't");
var rightWords = new Array("can not", "people", "will not");
var x = 0
if(textfield.value.search(regex) > -1) {
document.getElementById('status').innerHTML = "We found invalid characters";
textfield.value = textfield.value.replace(regex, "");
}
while(textfield.value.search(wrongWords) === true){
textfield.value = textfield.value.replace(wrongWords[x], rightWords[x]);
x++;
}
}
while 语句有什么问题。我怎样才能让它工作?