[js] select value

Pagina: 1
Acties:

  • Yo-han
  • Registratie: December 2001
  • Laatst online: 08-07 11:19
ik heb een klein kort vraagje... O-)

code:
1
2
3
4
5
6
<select name="blaat_keuze" 
onchange="polls.location.href='this.[this.selectedIndex].value';">
<option value="#" selected>maak een keuze</option>
<option value="blaat_1.php?id=1" >blaat 1</option>
<option value="blaat_2.php?id=2" >blaat 2</option>      
</select>


het probleem is dat in onchange="polls.location.href='this.[this.selectedIndex].value';" dit stukje waarcijnlijk een fou zit. Hij geeft namelijk de value niet door.
Iemand die deze java n00b kan helpen? ;)

  • Bosmonster
  • Registratie: Juni 2001
  • Laatst online: 29-08 19:47

Bosmonster

*zucht*

onchange="polls.location.href='this.[this.selectedIndex].value';"

onchange="polls.location.href=this.options[this.selectedIndex].value"

zoiets?

  • crisp
  • Registratie: Februari 2000
  • Laatst online: 14:02

crisp

Devver

Pixelated

java != javascript, maar anyhow:
code:
1
onchange="polls.location.href=this.options[this.selectedIndex].value"

of gewoon
code:
1
onchange="polls.location.href=this.value"

:)

Edit: Te laat... ;)

Intentionally left blank


  • Bosmonster
  • Registratie: Juni 2001
  • Laatst online: 29-08 19:47

Bosmonster

*zucht*

crisp schreef op 09 oktober 2002 @ 10:04:
java != javascript, maar anyhow:
code:
1
onchange="polls.location.href=this.options[this.selectedIndex].value"

of gewoon
code:
1
onchange="polls.location.href=this.value"

:)

Edit: Te laat... ;)


Die laatste werkt alleen niet in NS4.. maar who cares :)

  • Yo-han
  • Registratie: December 2001
  • Laatst online: 08-07 11:19
het winnende antwoord was inderdaad:

code:
1
onchange="polls.location.href=this.options[this.selectedIndex].value"


mijn dank is groot! :)