View Full Version : print alternate page

01-20-2005, 12:15 AM
Hello all,
I can print an alternate page if I include this line...
<link rel="alternate" media="print" href="www.yahoo.com">
but how can I include several different alternate print pages and print one of them with an onclick event link. How can I go about doing that??

01-20-2005, 08:52 PM
You could have different CSS files and change them dynamically. I do something similar to allow folks to change the font size. Then when the click the link it swaps the CSS.

Here's the function I use:

// Change CSS file.
// cssId: ID of <link> to CSS file.
// cssFile: Name of CSS file.
// Example: changeCSS("cssBody", "body1.css");
function changeCSS(cssId, cssFile){
cssCurr = document.getElementById(cssId).href;
path = cssCurr.substring(0, cssCurr.lastIndexOf("/"));
cssFull = path+"/"+cssFile;

Then I define my CSS link with the ID I want to swap out. For example:

<link id="cssBody" href="/include/cssbody1.css" rel="stylesheet" type="text/css" media="all">