简体   繁体   English

不同的样式表以便打印

[英]Different stylesheets in order to print

My issue is: I have this web page and i use print type in my css stylesheet. 我的问题是:我有此网页,并且在CSS样式表中使用打印类型。 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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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