cHUCk
|
Posted: 06/20/2006, 1:41 AM |
|
Hola a todos, primer vez k posteo en espanol, necesito su ayuda para referenciar del lado del cliente (Javascript) el valor actual de un listbox, la funcion es evento->listbox_change
estoy usando algo asi
var mivar=document.forms["miformulario"].milistbox.value;
Esto me devuelve un 'undefined' como valor... como obtener el valor actual del listbox por favor?
gracias!
cHUCk
|
|
|
lvalverdeb
Posts: 299
|
Posted: 06/20/2006, 6:47 AM |
|
Chuck,
Prueba con:
var mivar = document.forms["miformulario"].milistbox.selectedIndex;
valor = document.forms["miformulario"].milistbox.options[selectedIndex].value;
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
|
|
Hidran
|
Posted: 06/20/2006, 6:50 AM |
|
Puedes ponerlo asì:
var listbox=document.forms["miformulario"].milistbox;
var mivar=listbox.options[listbox.selectedIndex].value;
O le pones un id a la listbox y haces asì:
var listbox=document.getElementById("idlistbox");
var mivar=listbox.options[listbox.selectedIndex].value;
Hidran
"cHUCk" <cHUCk@forum.codecharge> ha scritto nel messaggio
news:304497b4c11b644@news.codecharge.com...
> Hola a todos, primer vez k posteo en espanol, necesito su ayuda para
> referenciar
> del lado del cliente (Javascript) el valor actual de un listbox, la
> funcion es
> evento->listbox_change
>
> estoy usando algo asi
>
> var mivar=document.forms["miformulario"].milistbox.value;
>
> Esto me devuelve un 'undefined' como valor... como obtener el valor actual
> del
> listbox por favor?
>
> gracias!
>
> cHUCk
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|