Agregar opciones a select en tiempo de carga
Publicado por Inexperta (12 intervenciones) el 19/12/2005 14:47:28
¿ Podría alguien probar este pequeño script, porqué no funciona agregar opciones al select en tiempo de carga ?
Desde ya, Muchas Gracias por su ayuda.
<html>
<head>
<script language="javascript">
<!--
function AgregarOpciones(){
f=document.formu.sele;
for(i=1; i<5; i++){
long=f.length + 1;
f.length=long;
f.options[long].value="n" + long;
f.options[long].text="opcion " + long;
}
}
//-->
</script>
</head>
<body onload="AgregarOpciones()">
<form name="formu" method="post">
<p><select name="sele">
<option value="n1">opcion 1</option>
</select></p>
</form>
</body>
</html>
Desde ya, Muchas Gracias por su ayuda.
<html>
<head>
<script language="javascript">
<!--
function AgregarOpciones(){
f=document.formu.sele;
for(i=1; i<5; i++){
long=f.length + 1;
f.length=long;
f.options[long].value="n" + long;
f.options[long].text="opcion " + long;
}
}
//-->
</script>
</head>
<body onload="AgregarOpciones()">
<form name="formu" method="post">
<p><select name="sele">
<option value="n1">opcion 1</option>
</select></p>
</form>
</body>
</html>
Valora esta pregunta


0