简体   繁体   中英

Different stylesheets in order to print

My issue is: I have this web page and i use print type in my css stylesheet. What i need is to have two buttons, which would be:

Client Print
Member Print

For a specific web page. The only difference between them is that the second one has a field more to be printed.

I need to have this two buttons that take different stylesheets for the webpage.. Could someone help me?

<link rel="stylesheet" href="../css/style.css" media="screen, projection,print" />

For the first one i need:

for the second one:

<link rel="stylesheet" href="../css/style1.css" media="screen, projection,print" />

Try this:

function print(o) {
    var head = document.getElementsByTagName('head')[0].innerHTML;
    if (o == 'client') {
        head += '<link rel="stylesheet" href="../css/style.css" media="screen, projection,print" />';
    }
    if (o == 'member') {
        head += '<link rel="stylesheet" href="../css/style1.css" media="screen, projection,print" />';
    }
    document.getElementsByTagName('head')[0].innerHTML = head;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM