Form checkbox validation
Jeg er i gang med at lave en udfyldningsformular hvor brugeren skal indtaste oplysninger om fornavnavn og efternavn mm. og ikke mindst skal brugeren markere/taste checkbox'en inden man sender formularen. Jeg har brugt et javascript jeg fandt på nettet til at checke om felterne er blevet udfyldt, men jeg kan ikke få checkbox til at virke. Er der nogen der kan se hvad fejlen er? Dropdown og felterne virker ellers fint at man får advarsel, men det er bare checkboxen der mangler.Siden kan ses på:
www.iggu.gl/bestil/Check.htm
Og script'ene:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bestilling</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript">
function CheckTheForm() {
var result = true;
var msg="";
if (document.form.For_Navn.value=="") {
msg+="Udfyld dit fornavn! \n";
document.form.For_Navn.focus();
document.getElementById('First_Name2').style.color="red";
result = false;
}
if (document.form.Efter_Navn.value=="") {
msg+="Udfyld dit efternavn!\n";
document.form.Efter_Navn.focus();
document.getElementById('Last_Name2').style.color="red";
result = false;
}
if (document.form.Pakke.value=="") {
msg+="Vælg en pakke!\n";
document.form.Pakke.focus();
document.getElementById('Pakke').style.color="red";
result = false;
}
if (document.form.Agree.value=="") {
msg+="Husk at godkende!\n";
document.form.Agree.focus();
document.getElementById('Agree').style.color="red";
result = false;
}
if(msg==""){
return result;
}{
alert(msg)
return result;
}
}
</script>
<script type="text/javascript" language="JavaScript">
<!-- hide
function addToFavorites(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
// Popup window function
function newWindow(url) {
popupWindow = window.open(url,'popUpWindow','height=600,width=600,left=50,top=50,resizable=yes,scrollbars=1,toolbar=no,menubar=no,location=no,directories=no,status=no');
}
// end hide -->
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body bgcolor="#9595FF" leftmargin="0" topmargin="0" marginwidth="0">
<div align="center">
<table width="678" cellspacing="0" cellpadding="0">
<tr>
<td width="676" bgcolor="#FFFFFF"><br>
<form name="form" method="post" action="output.php">
<table width="614" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td colspan="3"> <div align="right"></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="144" bgcolor="#EFEFF8"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif"></font></div></td>
<td width="196" bgcolor="#EFEFF8"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="id" type="hidden" id="id" size="7">
</font></div></td>
<td width="272" rowspan="8" valign="top" bgcolor="#EFEFF8"> <div align="center"></div> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">
</font></div>
<div align="center"></div>
<div align="left"><font size="2" face="Arial, Helvetica, sans-serif"></font><font size="2" face="Arial, Helvetica, sans-serif"></font><font size="2" face="Arial, Helvetica, sans-serif"></font><br>
</div></td>
</tr>
<tr bgcolor="#EFEFF8">
<td bgcolor="#EFEFF8"><div align="right"></div></td>
<td bgcolor="#EFEFF8"><p>
<label></label>
<br>
</p></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#EFEFF8"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif">Fornavn:</font></div></td>
<td bgcolor="#EFEFF8"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="For_Navn" type="text" id="First_Name2">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#EFEFF8"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif">Efternavn:</font></div></td>
<td bgcolor="#EFEFF8"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="Efter_Navn" type="text" id="Last_Name2">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="2" bgcolor="#EFEFF8"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#EFEFF8"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif">Pakke::</font></div></td>
<td bgcolor="#EFEFF8"> <div align="left">
<label></label>
<div align="right"><font size="2" face="Arial, Helvetica, sans-serif">
<select name="Pakke" size="1" id="Pakke">
<option selected>Vælg </option>
<option value="Pakke_1">Pakke 1</option>
<option value="Pakke_2">Pakke 2</option>
</select>
</font><img src="images/pakkestreg.gif" width="88" height="17"></div>
</div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#EFEFF8"> <div align="right"><font size="2" face="Arial, Helvetica, sans-serif">eMail:</font></div></td>
<td bgcolor="#EFEFF8"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="eMail_Adresse" type="text" id="eMail_Address2">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" bgcolor="#EFEFF8"><div align="right"><font size="2" face="Arial, Helvetica, sans-serif">Beskedt:</font></div></td>
<td height="22" bgcolor="#EFEFF8"><textarea name="Besked" cols="17" rows="6" id="Besked"></textarea></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#D7D7FF"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">
</font></div></td>
<td> <div align="right">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#D7D7FF"> <div align="center"><br>
<input name="Agree" type="checkbox" value="Agree">
<font size="2" face="Arial, Helvetica, sans-serif"><strong><a href="java script:newWindow('piumasaqaatit.html')"> Godkend </a> <br>
<br>
</strong></font></div></td>
</tr>
</table>
<font size="2" face="Arial, Helvetica, sans-serif"></font></div></td>
<td bgcolor="#D7D7FF"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="3" bgcolor="#EFEFF8"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="43%" bgcolor="#D7D7FF"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif">
<input name="submit" type="submit" class="submit_button" value="Send" onClick="return CheckTheForm();">
</font></div></td>
<td width="9%" bgcolor="#D7D7FF"> </td>
<td width="48%" bgcolor="#D7D7FF"><font size="1" face="Arial, Helvetica, sans-serif">
<input type="reset" value="Slet" name="B2">
</font></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFFF">
<td bgcolor="#D7D7FF"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">
</font></div></td>
<td> <div align="right">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#D7D7FF"> <div align="center"><br>
<font size="1" face="Arial, Helvetica, sans-serif"> </font><font size="2" face="Arial, Helvetica, sans-serif"><strong><br>
<br>
</strong></font></div></td>
</tr>
</table>
<font size="2" face="Arial, Helvetica, sans-serif"></font></div></td>
<td bgcolor="#D7D7FF"> <div align="left"><font size="2" face="Arial, Helvetica, sans-serif">
</font></div></td>
</tr>
<tr bgcolor="#FFFFFF">
<td colspan="3" bgcolor="#EFEFF8"> <div align="center"></div></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>