function trim(){
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.trim=trim;
function removecrlf(){
return this.replace(/\n/g,"");
}
String.prototype.removecrlf=removecrlf;
function CheckForm () {
//Check for a name
if (document.forumregs.Namn.value.removecrlf().trim().length==0){
alert("YOUR NAME! OUT WITH IT!");
document.forumregs.Namn.focus();
return false;
}
//Check for comments
if (document.forumregs.Meddelande.value.removecrlf().trim().length==0){
alert("the people demand a message!");
document.forumregs.Meddelande.focus();
return false;
}
return true
}
Jag gör denna kod och ÄNDÅ klarar folk lägga in tomma poster...