check den ud
Hvad er fejlen i følgende script. Det er kun det nederste to knapper der kan skifte farve når man klikker knapperne.<body>
<html>
<head>
<title>Ude og hjemme</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript1.1">
function karakter1(hvilken) {for(i=1;i<=2;i++) {document.form1.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
function karakter2(hvilken) {for(i=1;i<=2;i++) {document.form2.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
function karakter3(hvilken) {for(i=1;i<=2;i++) {document.form3.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
function karakter4(hvilken) {for(i=1;i<=2;i++) {document.form4.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
function karakter5(hvilken) {for(i=1;i<=2;i++) {document.form5.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
function karakter6(hvilken) {for(i=1;i<=2;i++) {document.form6.karakter.value=hvilken;if(i == hvilken)
{document.images["karakter" + hvilken].src="green.gif"} else {document.images["karakter" + i].src="red.gif"}}}
</script>
</head>
<body bgcolor="#DDDDDD" text="#000000">
<form name="form1" method="post" action="test1.htm">
<input type="hidden" name="person" value="jfn">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter1(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter1(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
<form name="form2" method="post" action="test1.htm">
<input type="hidden" name="person" value="pd">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter2(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter2(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
<form name="form3" method="post" action="test1.htm">
<input type="hidden" name="person" value="fh">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter3(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter3(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
<form name="form4" method="post" action="test1.htm">
<input type="hidden" name="person" value="bh">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter4(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter4(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
<form name="form5" method="post" action="test1.htm">
<input type="hidden" name="person" value="rj">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter5(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter5(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
<form name="form6" method="post" action="test1.htm">
<input type="hidden" name="person" value="tr">
<input name="karakter" type="hidden">
<table border="0" width="818" cellpadding="0" cellspacing="0">
<tr>
<td width="150"> </td>
<td width="7">
<div align="left">
<input type="submit" name="gem" value="Gem">
</div>
</td>
<td width="60">
<div align="center"> <a href="java script:karakter6(1)" onfocus="this.blur()"><img name="karakter1" src="red.gif"></a>
</div>
</td>
<td width="41"> </td>
<td width="40">
<div align="center"> <a href="java script:karakter6(2)" onfocus="this.blur()"><img name="karakter2" src="green.gif"></a>
</div>
</td>
<td width="31"> </td>
<td width="219"> </td>
<td width="39"> </td>
<td width="149"> </td>
</tr>
</table>
</form>
</body>
</html>