admin管理员组文章数量:1319465
I have a print button on my page that will run window.print(), it just prints the page exactly. Is there a way to pass a parameter to that function so that it will print my page with the stylesheet print.css rather than style.css, without necessitating a page refresh?
I have a print button on my page that will run window.print(), it just prints the page exactly. Is there a way to pass a parameter to that function so that it will print my page with the stylesheet print.css rather than style.css, without necessitating a page refresh?
Share Improve this question asked Feb 18, 2011 at 8:12 AKorAKor 8,89229 gold badges88 silver badges139 bronze badges1 Answer
Reset to default 10In your css put any print specific CSS rules into
@media print{ }
And css rules for displaying into
@media screen, projection, tv{ }
HTML will look this
<link href="default.css" rel="stylesheet" type="text/css" media="all" /> <link href="print.css" rel="stylesheet" type="text/css" media="print" />
版权声明:本文标题:javascript - Using window.print() to print a different stylesheet without restyling the page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742061659a2418617.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论