js 怎么实现打印页面的一部分内容

JavaScript025

js 怎么实现打印页面的一部分内容,第1张

<table width="100%" align="center" style="border-collapse: collapse">

<tbody>

<tr class="no_print" height="20" bgcolor="#f7f7f7" align="center">

<td height="25" colspan="3">

<input type="button" name="print" value="打印" onclick="preview('PrintContentDiv')" />

</td>

</tr>

</tbody>

</table>

<div id="PrintContentDiv">

<!--这里写内容-->

</div>

文本框内容显示在指定地方:就是一个dom内容转移的操作,使用Jquery获取原生js都很好实现,配合具体js事件实现。具体操作如下: //假定文本框的id='mytext',指定显示区域的id='show' //div/span/p等节点,不是文本元素function fun(){ getEle('s...