使用asp.net打印javascript函数 [英] print javascript function using asp.net
本文介绍了使用asp.net打印javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用下面的javascript函数来打印页面
I am using below javascript function for printing a page
function pagePrint(heading) {
var mytext;
var divMyArea = document.getElementById('printTable');
if (divMyArea.innerHTML != '')
mytext = "<table style='color:Black; Width:100%;'><tr><td>";
mytext = mytext + " <table><tr><td colspan=2><h1>" + heading + "</h1></td></tr></table>";
mytext = mytext + ' ' + divMyArea.innerHTML.replace(/TBODY/g, "table border=1");
mytext = mytext + "<table width=100%><tr><td colspan=2 align=right><img src=images/logo.png ></td></tr></table>";
mytext = mytext + " </td></tr></table>";
mytext = mytext.replace(/color: white;/g, "color: black;");
mytext = mytext.replace(/COLOR: white;/g, "color: black;");
mytext = mytext.replace(/font-family: arial;/g, "font-family: times new roman;");
mytext = mytext.replace(/FONT-FAMILY: arial;/g, "font-family: times new roman;");
mytext = mytext.replace(/font-size: 10pt/g, "FONT-SIZE: 12pt");
mytext = mytext.replace(/FONT-SIZE: 10pt/g, "FONT-SIZE: 12pt");
window.open("print.html", "", "").document.write(mytext + '<input type="button" onClick=window.print(); value="Print">');
}
如何在上述功能中将控件的可见性设置为false
请帮助我.
How can I set the visibility for control to false in above function
plz help me.
推荐答案
AFAIK,您只能使用javascript打印网页的内容.因此,如果使表格不可见,它将不会打印.
您最好打开一个新的打印机友好"页面,然后允许用户打印该页面.但是即使在那儿,您也只能打印显示的内容!
AFAIK, you can only print the content of a webpage in javascript. So if you make your table invisible, it won''t print.
You might be better of opening a new "printer friendly" page instead, and allowing the user to print that instead. But even there, you can only print what you display!
这篇关于使用asp.net打印javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文