两个打印按钮在不同的css在同一页...可能? [英] Two print buttons with different css on the same page... Possible?

查看:192
本文介绍了两个打印按钮在不同的css在同一页...可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Dreamweaver,以 php 编码。

I'm working with Dreamweaver, coded in php.

在我的其中一个网页上,我尝试添加2个不同的 print 按钮,每个打印网页的不同部分。例如,一个打印按钮正在打印第一段,另一个打印按钮正在打印第二段

On one of my pages, I'm trying to add 2 different print buttons, each one printing a differrent portion of the webpage. For example, one print button is printing the first paragraph and the other print button is printing the second paragraph.

我为这两个按钮执行了打印CSS ,并将每个按钮链接到各自的打印CSS 打印CSS 覆盖第一个,所以我最终有两个打印按钮具有相同的CSS

I did the print CSS for both buttons and I linked each to its respective print CSS, but the second print CSS overrules the first one, and so I end up having two print buttons with the same CSS...

推荐答案

您可以根据按钮点击时动态更改打印CSS,例如:

You could dynamically change the print CSS based upon which button is clicked with something like this:

在样式表引用中添加标识:

Add an id to your stylesheet reference:

<link rel="stylesheet" href="print1.css" id="printCss" media="print">

向您的按钮添加点击事件:

Add an on click event to your button:

<input type="button" onclick="swapCss();"/>

动态交换css文件:

function swapCss() {
    document.getElementById('printCss').href = 'print2.css';
}

这篇关于两个打印按钮在不同的css在同一页...可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆