Avatar billede frank1973 Nybegynder
15. november 2002 - 11:46 Der er 2 kommentarer og
1 løsning

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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </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">&nbsp;</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">&nbsp; </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">&nbsp;</td>
      <td width="219">&nbsp; </td>
      <td width="39">&nbsp;</td>
      <td width="149">&nbsp; </td>
    </tr>
  </table>
</form>
</body>
</html>
Avatar billede roskilde1987 Juniormester
15. november 2002 - 13:15 #1
Du har sikkert tastet forkert!!!!!
Avatar billede frank1973 Nybegynder
04. december 2002 - 15:07 #2
Jeg lukker her.
Avatar billede frank1973 Nybegynder
04. december 2002 - 15:07 #3
!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester