如何用不同于print.css的样式表打印网页 [英] How to print web page with a different stylesheet other than print.css

查看:167
本文介绍了如何用不同于print.css的样式表打印网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个print.css管理页面的打印输出,但我想创建basic-print.css打印出非常基本的信息。我如何创建一个按钮,使用basic-print.css而不是print.css打印网页?

I've already got a print.css that manages print outs of a page but I want to create basic-print.css which prints out very basic information. How would I create a button that prints the web page out using basic-print.css instead of print.css?

提前感谢。

编辑:我要实现的快速示例...

quick example of what I'm trying to achieve...


  1. CTRL + P文件>打印)==使用print.css

  2. 点击按钮名为基本打印==使用basic-print.css


推荐答案

这只是一个想法,但是你尝试用JavaScript加载basic-print.css文件?

This is just an idea, but have you tried loading the basic-print.css file with JavaScript?

我想到的东西(使用jQuery库):

I'm thinking of something like (using the jQuery library):

$(document).ready(function(){
    $('#print-basic-button').click(function(){
       $('link').first().removeAttr('href').attr('href', 'basic-print.css');
    });
});

这篇关于如何用不同于print.css的样式表打印网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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