2011-02-23 85 views

回答

1

看一看jQuery Print Element v1.2。這顯然需要在您的項目中包含jQuery JS file。正如MattP指出的那樣,它可以在沒有jQuery和額外插件的情況下完成,但我總是傾向於jQuery來實現跨瀏覽器兼容性。

HTML

<div id="printDiv">Content to be printed</div> 

JS/jQuery的

$('#printDiv').printElement();