...

View Full Version : print alternate page



nikko50
01-19-2005, 11:15 PM
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??

don
01-20-2005, 07: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;
document.getElementById(cssId).href=cssFull;
}

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">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum