Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.Open Issue

Status
Not open for further replies.

Canelas

Programmer
Feb 20, 2008
46
PT
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.
 
Oh, and by the way...
The error description, on the left side of the status bar in the parent window, is an "access denied" error. This error only appears after i try to run the javascript function.

Thanks.
 
I got it fixed.
The url for the new window was too big.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top