det är väll mellanslag..
behöver för mellanslag och enter.. koden är typ:
<!--
//Function to check form is filled in correctly before submitting
function CheckForm () {
//Check for a name
if (document.forumregs.Namn.value==""){
alert("YOUR NAME! OUT WITH IT!");
document.forumregs.Namn.focus();
return false;
}
//Check for comments
if (document.forumregs.Meddelande.value==""){
alert("the people demand a message!");
document.forumregs.Meddelande.focus();
return false;
}
if (document.forumregs.Meddelande.value=="vbCrLf"){
alert("the people demand a message!");
document.forumregs.Meddelande.focus();
return false;
}
return true
}
// -->
<script language="JavaScript">
<!--
//Function to check form is filled in correctly before submitting
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==""){
alert("YOUR NAME! OUT WITH IT!");
document.forumregs.Namn.focus();
return false;
}
//Check for comments
if (document.forumregs.Namn.value.removecrlf().trim().length==0){
alert("the people demand a message!");
document.forumregs.Meddelande.focus();
return false;
}
return true
}
// -->
</script>
Japp, fast det skall vara Meddelande.value ser jag nu, men du kan använda samma funktion för både namn och meddelande så slipper du "mellanslag" som namn.
<!--
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==""){
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();