Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/11/2004, 12:37
angsanchez
 
Fecha de Ingreso: octubre-2004
Ubicación: España
Mensajes: 894
Antigüedad: 20 años, 4 meses
Puntos: 3
Hola, masterjail
He probado tu código y ambas versiones me funcionan bien. El error debe estar en otra parte del código (¿el formulario?). Revísalo o ponlo aquí completo.

Éste es el mío:
Código HTML:
<html>
<head>
<script language="javascript" type="text/javascript">
function leeSelect1() {
var indice = document.formul.miSelect.selectedIndex;
var textoEscogido = document.formul.miSelect.options[indice].text;
alert(textoEscogido)
}
function leeSelect2() {
var indice = document.forms[0]["miSelect"]["selectedIndex"];
var textoEscogido = document.forms[0]["miSelect"]["options"][indice]["text"];
alert(textoEscogido)
}
</script>
</head>

<body>
<form name="formul">
<select name="miSelect">
<option id="1" value="a1">Opción 1</option>
<option id="2" value="a2">Opción 2</option>
<option id="3" value="a3">Opción 3</option>
</select>
<br>
 <input type="button" value="Leer método 1" onClick="leeSelect1()">
 <input type="button" value="Leer método 2" onClick="leeSelect()">
</form>


</body>
</html> 
__________________
Angel :cool: