I had a situation where I needed to change what would be printed based on what button on the web page the user clicked. Here is an easy way to do that.
<style type="text/css" media="print" id="printStyles">
</style>
<script>
function printOptionA() {
var styles = "#optionA {display: block;} #optionB {display:none;}";
$('#printStyles').text(styles);
window.print();
}
function printOptionB() {
var styles = "#optionB {display: block;} #optionA {display:none;}";
$('#printStyles').text(styles);
window.print();
}
</script>
The two functions can be called from button, hyperlinks, etc.
If the user just does a Control-P to print in the browser it will print the page as expected (neither of these changes). There is no need to undo these changes after printing.
6 comments:
good information thanks for sharing
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Best SEO and Digital Marketing Agency/company in Bangalore!
Thanks for the amazing information. For Best Edius X Pro Price In India.
Visit : editpointindia.com
Mulesoft certificationmulesoft certification training training helps learners prepare effectively for industry-recognized exams.
Fantastic article! Our database modeling course
equips professionals to structure data, design schemas, and improve database efficiency. Hands-on learning ensures skills you can apply immediately.
I found this article really interesting and educational. The explanations are simple and clear. Looking forward to reading more posts from you.online ba analyst course
This aws devops course helps learners understand cloud and deployment concepts through simple and practical learning sessions.
Post a Comment