0
I want to generate a clean print page with some information only. For this I am using the following code (well summarized) in javascript:
function myFunction() {
var myWindow = window.open(" ", "_self");
var str1 = "Janela de Impressão";
var result1 = str1.fontsize(5);
myWindow.document.write("<strong><center>", result1, "</center></strong>");
var str2 = "Dados da Impressão";
var result2 = str2.fontsize(5);
myWindow.document.write("<strong><br><br>", result2, "</strong>");
var salario_bruto = document.getElementById("salario").value;
myWindow.document.write("<strong><br>Salário: </strong>");
myWindow.document.write(salario_bruto);
}
<div>
Salário: <input id="salario" name="salario" type="text">
<button type="button" onclick="myFunction()">Imprimir</button>
</div>
I tested this offline and it worked perfectly. But when I went up to the site I click on "print" and don’t pass on the salary amount. Any idea? Thanks.
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack