Ver Mensaje Individual
  #8 (permalink)  
Antiguo 04/07/2008, 15:10
Avatar de foreverOdd
foreverOdd
 
Fecha de Ingreso: noviembre-2007
Ubicación: Caracas
Mensajes: 489
Antigüedad: 17 años, 5 meses
Puntos: 14
Respuesta: Problema con onchange

pon esto en el HEAD

Código PHP:
<script>
function 
setValores(){

document.getElementById('ProyMontoValor').value=document.getElementById('miSelect').options[document.getElementById('miSelect').selectedIndex].value;
//esta linea asigna el value de la opcion del combo al text con id='ProyMontoValor'
document.getElementById('ProyNombre').value=document.getElementById('miSelect').options[document.getElementById('miSelect').selectedIndex].text;
//esta linea asigna el text de la opcion del combo al text con id='ProyNombre'
}
</script> 
el resto seria:

Código PHP:

<table style="border: 1px solid black;" bgcolor=#F5F5F5 cellspacing=10 width=100%>
<tr><td><b>Proyecto: </b>
<select onchange="setValores()" name="A_GMonto" id='miSelect'>
<option value=0>Seleccione un Proyecto...</option>
<?php
$proy 
mysql_query("SELECT * FROM proymonto") or die("Error al seleccionar el Proyecto");
while(
$f mysql_fetch_array($proy)) {
echo 
"<option value=ACA VALOR DEL PROYECTO>";
echo 
ACA NOMBRE DE PROYECTO
echo "</option>";
}
mysql_free_result($proy);

?>
</select>
</td></tr>
<tr><td><b>Valor del Monto ($): </b>&nbsp;
<input id="ProyNombre" type=text name="A_GMonto" readonly="readonly" size=10>
<input id="ProyMontoValor" type=text name="A_GMonto" readonly="readonly" size=10></td></tr>
Saludos
__________________
My path is lit by my own fire, I only go where I desire