/ Forside / Teknologi / Udvikling / HTML / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
HTML
#NavnPoint
molokyle 11184
Klaudi 5506
bentjuul 3377
severino 2040
smorch 1950
strarup 1525
natmaden 1396
scootergr.. 1320
e.c 1150
10  miritdk 1110
huske <SELECT>
Fra : spam]@mail.dk (Bo Ra~


Dato : 28-08-01 12:40

Ved at benytte nedenstående kode opdateres vTest2 når vTest1 ændres.

Det jeg så ønsker er, at når formlen er sendt og der trykkes tilbage
via browserens tilbageknap, så skal begge <SELECT> menuer stå på det
valgte, er dette overhovedet muligt ?

eksemplet kan også ses 'live' på www.rattenborg.com/test/

<SCRIPT>
   function update() {
      if(document.fTest['vTest1'].value == 1) {
      document.fTest['vTest2'].options.length = 3;
      document.fTest['vTest2'].options[0].text = "Vælg";
      document.fTest['vTest2'].options[0].value = false
      document.fTest['vTest2'].options[1].text = "1 1";
      document.fTest['vTest2'].options[1].value = "1 1";
      document.fTest['vTest2'].options[2].text = "1 2";
      document.fTest['vTest2'].options[2].value = "1 2";
      }

      if(document.fTest['vTest1'].value == 2) {
      document.fTest['vTest2'].options.length = 3;
      document.fTest['vTest2'].options[0].text = "Vælg";
      document.fTest['vTest2'].options[0].value = false
      document.fTest['vTest2'].options[1].text = "2 1";
      document.fTest['vTest2'].options[1].value = "2 1";
      document.fTest['vTest2'].options[2].text = "2 2";
      document.fTest['vTest2'].options[2].value = "2 2";
      }
   }
</SCRIPT>

<? if(!$submit) {
   $html[] = '<FORM NAME="fTest" ENCTYPE="multipart/form-data"
ACTION="'.$PHP_SELF.'" METHOD="post">';
   $html[] = ' <SELECT NAME="vTest1" onChange="JavaScript:
update()">';
   $html[] = ' <OPTION VALUE="false" SELECTED>Vælg';
   $html[] = ' <OPTION VALUE="1">1';
   $html[] = ' <OPTION VALUE="2">2';
   $html[] = ' </SELECT>';
   $html[] = ' <SELECT NAME="vTest2">';
   $html[] = ' <OPTION VALUE="false" SELECTED>Vælg';
   $html[] = ' </SELECT>';
   $html[] = ' <INPUT TYPE="submit" VALUE="submit"
NAME="submit">';
   $html[] = '</FORM>';
   
   print implode($html, chr(13).chr(10));
   }

else print 'vTest1 : '.$vTest1.'<BR>vTest2 : '.$vTest2;
?>



 
 
Søg
Reklame
Statistik
Spørgsmål : 177511
Tips : 31968
Nyheder : 719565
Indlæg : 6408596
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste