问题
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?
Thanks in advance.
Edit: quick example of what I'm trying to achieve...
- CTRL+P (or File > Print) == Use print.css
- Hit button called "Basic Print" == Use basic-print.css
回答1:
This is just an idea, but have you tried loading the basic-print.css file with JavaScript?
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');
});
});
来源:https://stackoverflow.com/questions/28897149/how-to-print-web-page-with-a-different-stylesheet-other-than-print-css