最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - html jquery - print specific image in page - Stack Overflow

programmeradmin6浏览0评论

I have an html page with a link like this:

<a href="javascript:window.print()">Print QR code</a>

When a user clicks it, it does what you think it will.. prints the whole page.. sadly, it does not print the QR code at all. How do I specify what I want to print? Like, lets say I want to print a specific image on the page?

I have an html page with a link like this:

<a href="javascript:window.print()">Print QR code</a>

When a user clicks it, it does what you think it will.. prints the whole page.. sadly, it does not print the QR code at all. How do I specify what I want to print? Like, lets say I want to print a specific image on the page?

Share Improve this question edited Jun 24, 2012 at 8:08 gdoron 150k59 gold badges302 silver badges371 bronze badges asked Jun 24, 2012 at 7:59 AturSamsAturSams 7,96218 gold badges67 silver badges106 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 2

I know this is an old post, but just wanted to share you this solution that worked very well without using jquery.

http://www.codescratcher./javascript/print-image-using-javascript/#ment-762

I found this plugin that does the trick:

http://projects.erikzaadi./jQueryPlugins/jQuery.printElement/

$('img#some_id').printElement();
发布评论

评论列表(0)

  1. 暂无评论