Yves PEYSSON a ecrit :
Ji, my problem is simple. I would like to set dynamically the pressed item
of a menu of a form in javascript. First, how to get the value of the item
that has been selected with the mouse. Then how to set it in javascript. I
don't know the object name. I do that like form.myfield.value = xxxx with an
input text, but it it doesnot work for menu !
Example :
<form action="" method="get">
<select onchange= if(this.options.selectedIndex==0)
alert('Do an other choice');
else
this.form.action=this.options[this.options.selectedIndex].value;">
<option selected>Choisir une ville - Select a Town
<option value="Paris.htm">Paris
<option value="London.htm">Londres - London
<option value="Tokio.htm">Tokio
</select>
<input type=submit value="GO !">
</form>
others possibilities :
this.form.myTextField.value=this.options[this.options.selectedIndex].value;
alert('Destination = '+this.options[this.options.selectedIndex].value);
self.location=this.options[this.options.selectedIndex].value;
and so on ...
--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************