<a href="http://domain.tld/target/" title="Print this page">Print This!</a>
Notice the new value for the
printClick() function on page load.
forloop and now target the specified anchor element directly, thereby producing a lighter, cleaner and all-around better function. Thanks Tuan Anh! :)
onload()function from the script when calling it from the bottom of the document (as prescribed in the following section). If you are calling the script from the
onload()function will need to be included. Thank you, Anatoli Papirovski! :)
Almost there.. the last thing you need to do is identify the “print this!” link by adding an
id attribute of “
print_this”. Place this code wherever you would like the “print this!” link to appear:
<a id="print_this" href="http://domain.tld/target/" title="Print this page">Print This!</a>
..and of course, you should also change the location of the
?> template tag for the
href value, thereby enabling “print this” links for every post on your site.
button element) next to a small bit of text that reminds people to print a copy of the page for their records. Note that the version of this method given at the Opera Dev site does not work in certain browsers due to a small error in syntax. In this version, the error has been fixed and the script should work properly in all modern web browsers.