var v = document.createElement("div"); //向v中追加打印数据,可以将界面的元素追加进来 var h = window.open("打印窗口", "_blank"); h.document.write( $(v).prop("outerHTML")); h.document.close(); h.print(); h.close();
function copyUrl () { var div = document.getElementById('xxxx'); if (document.body.createTextRange) { var range = document.body.createTextRange(); range.moveToElementText(div); range.select(); } else if (window.getSelection) { var selection = window.
function Print() { $.ligerDialog.confirm('确定要打印吗?', true, function (yes, value) { if (yes) { var oldhtml = document.body.innerHTML; document.body.innerHTML = document.getElementById('Print_DIV').outerHTML; window.print(); window.close(); .innerHTML d
JavaScript打印函数myPrint(obj): JavaScript打印页面指定div区域原理:使用window.open()在浏览器打开一个新的页面(window), 使用 window.document.write()将指定div区域的内容写入新窗口文档,document.close()关闭文档,使用window.print()调用打印机打印当前文档. function myPrint(obj){ //打开一个新窗口newWindow var newWindow=window.ope