Jump to content

javascript small problem


robert_gsfame

Recommended Posts

I have this function

 

function printContent(id){

str=document.getElementById(id).innerHTML

newwin=window.open('','printwin','left=100,top=0,width=810,height=800,scrollbars=yes');

newwin.document.write('<HTML>\n<HEAD>\n');

newwin.document.write('<TITLE>Print Page</TITLE>\n');

newwin.document.write('<link rel="stylesheet"/>');

newwin.document.write('<style type="text/css">');

newwin.document.write('</style>');

newwin.document.write('<script>\n')

newwin.document.write('function chkstate(){\n')

newwin.document.write('if(document.readyState=="complete"){\n')

newwin.document.write('window.close()\n')

newwin.document.write('}\n')

newwin.document.write('else{\n')

newwin.document.write('setTimeout("chkstate()",2000)\n')

newwin.document.write('}\n')

newwin.document.write('}\n')

newwin.document.write('function print_win(){\n')

newwin.document.write('window.print();\n')

newwin.document.write('chkstate();\n')

newwin.document.write('}\n')

newwin.document.write('<\/script>\n')

newwin.document.write('</HEAD>\n')

newwin.document.write('<BODY onload="print_win()">\n')

newwin.document.write(str)

newwin.document.write('</BODY>\n')

newwin.document.write('</HTML>\n')

newwin.document.close()

}

 

I only have a little problem with window.open(), i dont want to open a new window

 

thx

Link to comment
https://forums.phpfreaks.com/topic/191773-javascript-small-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.