Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/04/2007, 06:44
Section1
 
Fecha de Ingreso: diciembre-2003
Mensajes: 173
Antigüedad: 21 años, 1 mes
Puntos: 1
Re: un desplegable que segun la opción escogida, asigne 1 valor a otra variable

Buenas

Nu se algo debo hacer mal porke ni tan solo sale el formulario. Solo la pagina en blanco.

Codigo
<html>
<head>
<script type="text/javascript">
function update() {
theField = document.getElementById('texto')
theSelect = document.getElementById('lista').options[document.getElementById("lista").selectedIndex]
theField.value = theSelect.value
}
</script>
</head>
<body>
<form>
<select name="valor1" id="lista" size="1" onChange="update()">
<option value="1" selected>1</option> (valor escogido por el usuario)
<option value="2">2</option>
</select>
<br />

Valor2 <input name="valor2" id="texto" type="text" value="<?php echo ''.$texto ;>"/>
</form>
</body>
</html>

Un saludo,
Oriol