View Single Post
Old 03-12-2008, 01:13 PM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,489
sde is on a distinguished road
by innerHTML they mean use javascript to target an element in the page. your javascript can exist in the head. the code can get a little messy if you are writing it from scratch to support all browsers, but you could use a js library like JQuery and do it like this.

HTML Code:
<html>
<head>
  <script type="text/javascript" src="jquery.js" ></script>
  <script type="text/javascript" src="myscript.js" ></script>
</head>
<body>
  <p>My Web Page</p>

  <div id="print_div"></div>
</body>
</html>
myscript.js
HTML Code:
$(document).ready(function() {
  $('#print_div').html('<a href="javascript:window.print()">Print this page</a>');
});
If JS is not supported, nothing will be injected in print_div.

**edited**
__________________
Mike
sde is offline   Reply With Quote