JQuery printfunction: no content, no view
Posted
by Joris
on Stack Overflow
See other posts from Stack Overflow
or by Joris
Published on 2010-05-06T11:48:19Z
Indexed on
2010/05/07
10:18 UTC
Read the original article
Hit count: 366
I got a JQuery printfunction:
function doPrintPage()
{
myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600');
myWindow.document.open();
myWindow.document.write(document.getElementById("studentnummer").value);
myWindow.document.write(document.getElementById("Voornaam").value + " " + document.getElementById("Tussenvoegsel").value + " " + document.getElementById("Achternaam").value);
myWindow.document.write("</br>");
myWindow.document.write("Result");
myWindow.document.write(document.getElementById('tab1').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Tree");
myWindow.document.write(document.getElementById('tab2').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Open");
myWindow.document.write(document.getElementById('tab3').innerHTML);
myWindow.document.write("</br>");
myWindow.document.write("Free");
myWindow.document.write(document.getElementById('tab4').innerHTML);
myWindow.document.close();
myWindow.focus();
}
There are 3 gridviews (elements in "tab#"), and on the page that is generated by this script, eacht gridview gets a header (Results, Tree, Open, Free). It is possible that there is no gridview for "Tree". It would be nice if the "tree" header wouldn't be shown either. EDIT: I tried this:
if ($('tab4')[0]) {myWindow.document.write("Free");
myWindow.document.write(document.getElementById('tab4').innerHTML);
but it seems not to work either... Anyone knows the solution?
© Stack Overflow or respective owner