Hi everybody.
Need a little help.
I have an aspx with a link button that opens a new window. The content for this page isn't always the same size, and while the contents of the new page isn't bigger than the window size, the script works fine. However, if the new page contents don't fit in the window, it just opens the standard internet explorer error window "Internet Explorer cannot display the webpage".
Even stranger, is that the script is working fine in Firefox.
Here is the script:
<script language="javascript">
function windowPrint()
{
var txtPrint;
var newWindow;
var day;
var month;
var year;
var date=new Date();
day=date.getDate();
month=date.getMonth();
year=date.getFullYear();
txtPrint = document.getElementById("txtdiv").innerHTML;
newWindow = window.open("windowPrint.html?txtPrint="+txtPrint,"windowPrint","location=1,status=1,scrollbars=1");
newWindow.document.open("text/html");
newWindow.document.writeln("<html><head><link href=styles\\print.css type=text/css rel=stylesheet media=print></head><body onbeforeprint=document.getElementById(imprime).className=collapsed;>");
newWindow.document.writeln("<TABLE><TR><TD valign=top>");
newWindow.document.writeln("<BR><BR><img src=images\\logo.gif /></TD><TD><BR><BR>");
newWindow.document.writeln(txtPrint);
newWindow.document.writeln(day+"/"+month+"/"+year);
newWindow.document.writeln("</TD></TR>");
newWindow.document.writeln("<TR><TD><a id=imprime href=javascript:window.print();>Imprimir</a>");
newWindow.document.writeln("</TD></TR></TABLE></body></html>");
newWindow.document.close();
newWindow.focus();
}
</script>
Thanks in advance.
Need a little help.
I have an aspx with a link button that opens a new window. The content for this page isn't always the same size, and while the contents of the new page isn't bigger than the window size, the script works fine. However, if the new page contents don't fit in the window, it just opens the standard internet explorer error window "Internet Explorer cannot display the webpage".
Even stranger, is that the script is working fine in Firefox.
Here is the script:
<script language="javascript">
function windowPrint()
{
var txtPrint;
var newWindow;
var day;
var month;
var year;
var date=new Date();
day=date.getDate();
month=date.getMonth();
year=date.getFullYear();
txtPrint = document.getElementById("txtdiv").innerHTML;
newWindow = window.open("windowPrint.html?txtPrint="+txtPrint,"windowPrint","location=1,status=1,scrollbars=1");
newWindow.document.open("text/html");
newWindow.document.writeln("<html><head><link href=styles\\print.css type=text/css rel=stylesheet media=print></head><body onbeforeprint=document.getElementById(imprime).className=collapsed;>");
newWindow.document.writeln("<TABLE><TR><TD valign=top>");
newWindow.document.writeln("<BR><BR><img src=images\\logo.gif /></TD><TD><BR><BR>");
newWindow.document.writeln(txtPrint);
newWindow.document.writeln(day+"/"+month+"/"+year);
newWindow.document.writeln("</TD></TR>");
newWindow.document.writeln("<TR><TD><a id=imprime href=javascript:window.print();>Imprimir</a>");
newWindow.document.writeln("</TD></TR></TABLE></body></html>");
newWindow.document.close();
newWindow.focus();
}
</script>
Thanks in advance.