开发者

Javascript solution to print specified area. Cross-browser friendly

I am currently developing a site which requires a print option on the page. When clicked this button fires a script that prints all contents within a <span id='printArea'></span>.

I am using a jQuery plugin called printElement at the moment and it works very well in all browsers that I have tested except Google Chrome.

I have resear开发者_C百科ched this problem and applied a suggested solution involving a setTimeOut() but have had no luck.

My question is: can anyone suggest a good cross-browser solution for printing a defined area of a web page?


Could you not just create a printable stylesheet, which hides all the other areas of the page that you don't want printing?


<link rel="stylesheet" type="text/css" href="/css/yazdir.css" media="print" />

yazdir.css

@charset "utf-8";
nav, header, #status-bar, #sub-nav, #header-shadow, footer, #tips{
    display:none !important;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜