---
title: "Hjälp med att sätta ihopp kod"
type: "forum-thread"
url: "https://www.webforum.nu/amne/javascript/74744-hjälp-med-att-sätta-ihopp-kod"
topic: "JavaScript"
topic_url: "https://www.webforum.nu/amne/javascript"
author: "Wiklund!!"
published: "2003-04-23T06:36:30.000Z"
updated: "2003-04-23T11:51:49.000Z"
replies: 2
views: 139
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/javascript/74744-hjälp-med-att-sätta-ihopp-kod"
---

# Hjälp med att sätta ihopp kod

## #1 — Wiklund!!, 2003-04-23T06:36Z

Är helt värdelös på javascript. Skulle nån kunna hjälpa mig att satta ihopp dessa 3 koder till 1? Skulle vilja ha det i den ordning som det är här nedanför.

\[kod\]
\<script language="javaScript"\>
function mess()
{
if (document.post.username.value.length\<3)
{
alert("Your username cannot be less than 3 characters!");
document.post.username.focus();
return false;
} else if (document.post.fname.value=="")
{
alert("You forgot to enter your first name!");
return false;
} else if (document.post.lname.value=="")
{
alert("You forgot to enter your last name!");
return false;
} else if (document.post.city.value.length\<3)
{
alert("The name of the city where you live cannot be less than 3 characters!");
document.post.city.focus();
return false;
}
}
\</script\>

\<script language="javaScript"\>
function mess()
{
    var pass1 = document.post.password1.value;
    var pass2 = document.post.password2.value;

    if (pass1 != pass2)
    {
        alert("Passwords did not match!");
        return false;
    }

    if (pass1.length \< 4)
    {
        alert("Your password cannot be less than 4 characters in length!");
        return false;
    }

    return true; // Jag som antar...
}
\</script\>

\<script language="javaScript"\>
function mess()
{
if (document.post.code.value.length\<5)
{
alert("Your active code cannot be less than 5 characters!");
document.post.code.focus();
return false;
}
}
\</script\>

Permalänk: https://www.webforum.nu/p/74744

## #2 — Jesper T, 2003-04-23T10:37Z

Så här menar du?:

```
<script language="javascript" type="text/javascript"> 
function mess() 
{ 
if (document.post.username.value.length<3) 
{ 
alert("Your username cannot be less than 3 characters!"); 
document.post.username.focus(); 
return false; 
} else if (document.post.fname.value=="") 
{ 
alert("You forgot to enter your first name!"); 
return false; 
} else if (document.post.lname.value=="") 
{ 
alert("You forgot to enter your last name!"); 
return false; 
} else if (document.post.city.value.length<3) 
{ 
alert("The name of the city where you live cannot be less than 3 characters!"); 
document.post.city.focus(); 
return false; 
} 
} 

function mess() 
{ 
var pass1 = document.post.password1.value; 
var pass2 = document.post.password2.value; 

if (pass1 != pass2) 
{ 
alert("Passwords did not match!"); 
return false; 
} 

if (pass1.length < 4) 
{ 
alert("Your password cannot be less than 4 characters in length!"); 
return false; 
} 

return true; // Jag som antar... 
} 
 
function mess() 
{ 
if (document.post.code.value.length<5) 
{ 
alert("Your active code cannot be less than 5 characters!"); 
document.post.code.focus(); 
return false; 
} 
} 
</script>
```

Permalänk: https://www.webforum.nu/p/1022815

## #3 — Peter S, 2003-04-23T11:51Z

```
<script type="text/javascript">
function mess(){
	if (document.post.username.value.length<3){
		alert("Your username cannot be less than 3 characters!");
		document.post.username.focus();
		return false;
	}
	else if (document.post.fname.value==""){
		alert("You forgot to enter your first name!");
		return false;
	}
	else if (document.post.lname.value==""){
		alert("You forgot to enter your last name!");
		return false;
	}
	else if (document.post.city.value.length<3){
		alert("The name of the city where you live cannot be less than 3 characters!");
		document.post.city.focus();
		return false;
	}
	else if (document.post.password1.value != document.post.password2.value){
		alert("Passwords did not match!");
		return false;
	}
	else if (document.post.password1.value.length<4){
		alert("Your password cannot be less than 4 characters in length!");
		return false;
	}
	else if (document.post.code.value.length<5){
		alert("Your active code cannot be less than 5 characters!");
		document.post.code.focus();
		return false;
	}
}
</script>
```

 :)

Permalänk: https://www.webforum.nu/p/1022881

---

Tråden på webben: https://www.webforum.nu/amne/javascript/74744-hjälp-med-att-sätta-ihopp-kod
