function doPrint(){ var turl = document.getElementById("iframeid").src; var newW = window.open(turl); newW.print(); }
类似还有:获取某个空间的值,然后打印
详细代码:
<div id='contect'> ssssssssss </div> <script type="text/javascript"> /*<![CDATA[*/ print_ele_f('contect'); function print_ele_f(id_s) { var ele = document.getElementById(id_s); var w = window.open('about:blank'); setTimeout(function(){ w.document.body.innerHTML = ele.innerHTML; w.print();},100) } /*]]>*/ </script>