What calls the Print Button to print

G

Guest

In this script below and the button information in the body following. What
connects the button to the script?

In other words I'd like to replace the standard grey "Print this document"
button with a printer Icon. Can I simply add the icon in place of the button
Id in the body?

<head>
var gAutoPrint = true; // Tells whether to automatically call the print
function
function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';
if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an
browser.Please update your browser.");
}
}
Script
</head>
------------------------------
<body>
<form id="printMe" name="printMe"> <input type="button" name="printMe"
onClick="printSpecial()" value="Print this Page" style="float: right"></form>
<div id="printReady">
</body>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top