By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,724 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

window.open / window.print

P: n/a
dan
This works in mozilla but I can't figure out why this won't work in
IE.
Say I have this html
<html>
header goes here
header goes here
header goes here
header goes here
header goes here
<div id="thecontent">
html goes here
tables etc
html goes here
html goes here
html goes here
<tag><tag><tag>
</div>

<img src="url" onclick="printIt()">

footer html goes here
footer html goes here
footer html goes here
footer html goes here

</html>
the printIt function looks like this

function printIt()
{
//grab the div in the html w/o the header & footer text
content=document.getElementById('thecontent');

//open a blank window
w=window.open('about:blank');

//write content var html to the window
w.document.write( content.innerHTML );

//write some javascript to make the newly opened window print itself.
w.document.writeln("<script>");
w.document.writeln("window.print()");
w.document.writeln("</"+"script>");
}
This will cause the print dialog to pop up in mozilla but doesnt
prompt to print in IE.
Is this a security issue?
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
<html>
<script type="text/javascript">
function printIt()
{
//grab the div in the html w/o the header & footer text
var content=document.getElementById('thecontent');
//open a blank window
w=window.open('about:blank');
//write content var html to the window
w.document.open();
w.document.write("<html>" + content.innerHTML);
//write some javascript to make the newly opened window print itself.
w.document.writeln("<script>window.print()</"+"script>");
w.document.writeln("</html>");
w.document.close();
}
</script>
header goes here<br />header goes here<br />
header goes here<br />header goes here<br />
header goes here<br />
<div id="thecontent">
html goes here<br />tables etc<br />
html goes here<br />html goes here<br />html goes here<br />
</div>
<img src="url" onclick="printIt()">
</html>

Tim
"dan" <ba*************@yahoo.com> wrote in message
news:74**************************@posting.google.c om...
This works in mozilla but I can't figure out why this won't work in
IE.
Say I have this html
<html>
header goes here
header goes here
header goes here
header goes here
header goes here
<div id="thecontent">
html goes here
tables etc
html goes here
html goes here
html goes here
<tag><tag><tag>
</div>

<img src="url" onclick="printIt()">

footer html goes here
footer html goes here
footer html goes here
footer html goes here

</html>
the printIt function looks like this

function printIt()
{
//grab the div in the html w/o the header & footer text
content=document.getElementById('thecontent');

//open a blank window
w=window.open('about:blank');

//write content var html to the window
w.document.write( content.innerHTML );

//write some javascript to make the newly opened window print itself. w.document.writeln("<script>");
w.document.writeln("window.print()");
w.document.writeln("</"+"script>");
}
This will cause the print dialog to pop up in mozilla but doesnt
prompt to print in IE.
Is this a security issue?

Jul 20 '05 #2

P: n/a
dan
"Tim Williams" <sa************@THISpacbell.net> wrote in message news:<J6*****************@newssvr27.news.prodigy.c om>...

<snip>
Thanks!

Tim

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.