Necesito un script que utilizaré para vender productos, que me permita multiplicar 2 digitos y me de el resultado en un tercer imput. el segundo y tercer imput tienen que estar bloqueado, para poner el precio yo, y el otro para que de el resultado y no puedan cambiarlo.
YO tengo uno, pero tengo que seleccionar el 3 imput (el de resultado) para que me el producto de la multiplicacion.
En resumen, 3 imput, el primero para que el cliente coloque la cantidad de productos Y al colocarla dé inmediatamente el resultado en el 3 imput, el segundo este bloqueado, donde el valor inicial sea el precio que yo coloque, y el tercero el resultado y tambien bloqueado. No se si me explique bien.
Coloco el script que tengo, para que me ayuden con el, o si me dan otro, les agradeceria.
Código HTML:
<head> <title>Operaciones matemáticas sencillas</title> </head> <body bgColor="#daddde"> <script language="JavaScript"> <!-- function dosqrt () { var number = document.form5.num.value; var ans = Math.sqrt(number); document.form5.num2.value = ans } function dosquare () { var number2 = document.form5.num3.value; var ans2 = eval(number2 * number2); document.form5.num4.value = ans2 } // --> </script> <script language="JavaScript"> <!-- function doinstruct () { alert("Entra los valores de cada operación. Las letras provocarán errores."); alert("Si no entras un número se considerará cero."); alert("Puedes pasar valores entre secciones."); alert("Haciendo esto borrará todos los datos de la selección."); } function dochange1 () { var result = document.form.cadd.value var insert = document.form.select.options[document.form.select.selectedIndex].value if (insert == "1") { document.form.aadd.value= result document.form.badd.value = "" document.form.cadd.value = "" } if (insert == "2") { document.form2.amult.value= result document.form2.bmult.value = "" document.form2.cmult.value = "" } if (insert == "3") { document.form3.asub.value= result document.form3.bsub.value = "" document.form3.csub.value = "" } if (insert == "4") { document.form4.adiv.value= result document.form4.bdiv.value = "" document.form4.cdiv.value = "" } if (insert == "0") { alert("You did not select an operation.") } } function dochange3 () { var result = document.form3.cdif.value var insert = document.form3.select.options[document.form.select.selectedIndex].value if (insert == "1") { document.form.aadd.value= result document.form.badd.value = "" document.form.cadd.value = "" } if (insert == "2") { document.form2.amult.value= result document.form2.bmult.value = "" document.form2.cmult.value = "" } if (insert == "3") { document.form3.asub.value= result document.form3.bsub.value = "" document.form3.csub.value = "" } if (insert == "4") { document.form4.adiv.value= result document.form4.bdiv.value = "" document.form4.cdiv.value = "" } if (insert == "0") { alert("You did not select an operation.") } } function dochange2 () { var result = document.form2.cmult.value var insert = document.form2.select.options[document.form.select.selectedIndex].value if (insert == "1") { document.form.aadd.value= result document.form.badd.value = "" document.form.cadd.value = "" } if (insert == "2") { document.form2.amult.value= result document.form2.bmult.value = "" document.form2.cmult.value = "" } if (insert == "3") { document.form3.asub.value= result document.form3.bsub.value = "" document.form3.csub.value = "" } if (insert == "4") { document.form4.adiv.value= result document.form4.bdiv.value = "" document.form4.cdiv.value = "" } if (insert == "0") { alert("You did not select an operation.") } } function dochange4 () { var result = document.form4.cdiv.value var insert = document.form4.select.options[document.form.select.selectedIndex].value if (insert == "1") { document.form.aadd.value= result document.form.badd.value = "" document.form.cadd.value = "" } if (insert == "2") { document.form2.amult.value= result document.form2.bmult.value = "" document.form2.cmult.value = "" } if (insert == "3") { document.form3.asub.value= result document.form3.bsub.value = "" document.form3.csub.value = "" } if (insert == "4") { document.form4.adiv.value= result document.form4.bdiv.value = "" document.form4.cdiv.value = "" } if (insert == "0") { alert("No seleccionaste una operación.") } } // --> </script> <center> <h1><font size="5"><br> </h1> <center> <script language="JavaScript"> <!-- function domult() { amult = eval(document.form2.amult.value); bmult = eval(document.form2.bmult.value); if (document.form2.bmult.value == "") { bmult = eval(document.form2.bmult.value = "0"); } if (document.form2.amult.value == "") { amult = eval(document.form2.amult.value = "0"); } prod = eval(amult * bmult); document.form2.cmult.value = prod } // --> </script> <form name="form2"> <p><input name="amult" KeyDown="domult()" size="20"></input> * <input name="bmult" size="20"></input> = <input name="cmult" onclick="domult()" size="20"></input><br> <input onclick="domult()" type="text" value="calcular" size="20"> <input type="reset" value="Restablecer"> </p> </form> <hr width="89%"> </font> </center></center> </body>