1
beauty?
I have a specific calculator and I want that when you click on the button it calculates and shows the values on another page. I tried to use window.open and I couldn’t. To open on the same page using the _self parameter I got it with this information; only to open at a specific address that does not.
<script> function calculadora(){
var v1 = document.getElementById("valor_1").value;
var v2 = document.getElementById("valor_2").value;
var v3 = document.getElementById("valor_3").value;
document.form.campo1.value = v1/2;
document.form.campo2.value = v2/3;
document.form.campo3.value = v3/4;
document.form.total.value = v1/2 + v2/3 +v3/4;
}
</script>
<script> novajanela(){
myWindow = window.open("https://www.novajanela.com/");
document.form.camp1.value = "valor 1 " + document.getElementById("campo1").value;
document.form.camp2.value = "valor 2 " + document.getElementById("campo2").value;
document.form.camp3.value = "valor 3 " + document.getElementById("campo3").value;
document.form.tot.value = "total " + document.getElementById("total").value;
}
</script>
***Html na Página 1***
<strong>Valor 1</strong><input name="valor 1" id="valor 1">
<p><strong>Valor 2</strong><input name="valor 2" id="valor 2"></p>
<p><strong>Valor 3</strong><input name="valor 3" id="valor 3">
<button value="Calcular" onClick="calculadora(); novajanela()" type="button">Calcular</button>
<input name="campo1" id="campo1">
<input name="campo2" id="campo2">
<input name="campo3" id="campo3">
<input name="total" id="total">
***html da página 2***
Resultado da Calculadora
<input name="camp1" id="camp1">
<input name="camp2" id="camp2">
<input name="camp3" id="camp3">
<input name="tot" id="tot">
Kd o
function
beforenovajanela()
?– Sam