Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/10/2013, 09:28
creatvdm
 
Fecha de Ingreso: octubre-2013
Mensajes: 4
Antigüedad: 10 años, 6 meses
Puntos: 0
Respuesta: Calcular variable a partir de un select

Vale tema solucionado.Gracias por la ayuda(grrrrrrrrr....!!!!)

En el evento onchange le paso la variable $total como parametro a la función...

<label for="stock">Select Uds.</label>
<select id="stock" name="stock" onChange="javascript:multiplicar(<?php echo $total ?>)">
<?php $i= 1; ?>
<?php do { ?>
<option value="<?php echo $i; ?>" style="color:#000;"><?php echo $i; ?></option>
<?php
$i++;
} while ($i <= $row_ConsultaBuzo['intStock']);
?>
</select>


Y en el javascript ejecuto la siguiente funcion ...

function multiplicar(variable) {
var selected = document.getElementById('stock').value;
var precio = variable;
var totales = selected * precio;
document.getElementById('preciototal').innerHTML = '<p id="preciototal">Total :&nbsp;' + totales + '&nbsp;€</p>';
}


Y listo....jejejejje esto me ha costado toda la mañana pero al final lo conseguí-...