Answers for "print javascript in html"

19

how to print to console javascript

console.log("string")
Posted by: Guest on February-13-2020
3

how to print a line in javascript

console.log("Your line would be here")//Prints a line on the console 
alert("Your message here")//Raises an alert
Posted by: Guest on April-27-2020
9

how to code print in javascript

console.log("print")
//or
alert("Print")
Posted by: Guest on April-07-2020
0

how to print in javascript

//It is very esay to print!
//This how to print in Javascript!
console.log("string");

var num = 1;

console.log(num);
Posted by: Guest on April-03-2021
-1

Printer Print using HTML

function PrintElem() {
    var mywindow = window.open('', 'PRINT');
    mywindow.document.write('<html><head><title>Payment Slip</title>');
    mywindow.document.write('</head><body style="text-align:center;font: Georgia, "Times New Roman", Times, serif;background: #fff;font-size: 22pt;margin:20px auto auto 50px;" >');
    mywindow.document.write('<header style="text-align:center; white-space:nowrap;overflow:hidden;line-height: 1em;">' +
    '<p  style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 12pt;">Payment Slip</p>' +
    '<p style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 1em;">' + $('.mylabelpaymentheader').html() + '</p>' +
'</header>');
    mywindow.document.write('<content style="text-align:center;">' +
    '<table style="margin-left: auto;margin-right: auto;border-collapse: collapse;font-size:16pt;">' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Name:</td><td  style="border:1px solid black">' + $('.lblName').html() + '</td></tr>' +
        '<tr style="border:1px solid black"><td style="border:1px solid black">Address:</td><td style="border:1px solid black">' + $('.lblAddress').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Meter No:</td><td  style="border:1px solid black">' + $('.lblMeterNo').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Token:</td><td  style="border:1px solid black">' + $('.lblToken').html() + '</td></tr>' +
    '</table>'+

'</content>' +
'<footer>' +
'<hr style="margin-top:30pt;margin-bottom:30pt;">' +
    '<p style="text-align:right;">© pdb</p>' +
'</footer>'+
'');
    mywindow.document.write('</body></html>');
    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/
    mywindow.print();
    mywindow.close();
    return true;
}
Posted by: Guest on August-07-2021

Browse Popular Code Answers by Language