Código HTML:
<form name="f1"> <select name="select1" onChange="displaydesc(document.f1.select1, thetext1, 'textcontainer1')"> <option value="1" selected>Router</option> <option value="2">Mouse</option> <option value="3">Teclado</option> <option value="4">Hub USB</option> <option value="5">Gabinete</option> </select> <span id="textcontainer1" align="left"></span> <!-- Acá se puestra el precio --> </form>
Código PHP:
<script type="text/javascript">
var thetext1=new Array() // Array con los precios de los productos
thetext1[0]="150.00"
thetext1[1]="98.33"
thetext1[2]="135.76"
thetext1[3]="224.65"
thetext1[4]="345.99"
// Función para camniar el precio en el SPAN
function displaydesc(which, descriptionarray, container)
{
if (document.getElementById)
{
document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex];
}
}
displaydesc(document.f1.select1, thetext1, 'textcontainer1')
</script>
Mil gracias de antemano y saludos...