473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

window.open / window.print

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
2 15971
<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
dan
"Tim Williams" <sa************@THISpacbell.net> wrote in message news:<J6*****************@newssvr27.news.prodigy.c om>...

<snip>
Thanks!

Tim

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard Bell | last post by:
Newbie question ... please respond to group I'm trying to open/navigate to a url. How can I tell when the page is fully loaded? Testing suggest that window.open returns before the page is...
1
by: billster | last post by:
Hi, I am trying to launch a new browser with the same url location as the current browser, and at the same time run some javascript. This works with <a...
1
by: jdapro | last post by:
Hi - thanks for reading this out there! I'll be quick about it: I've got this row of images (in the end there will be more rows of pics as well). When a user clicks on the image, I want a new...
4
by: vagos | last post by:
Hi, When opening a page, i want to open a new javascript window and close the first. like: <script language=javascript> function openw(){...
3
by: TM360 | last post by:
I realize this may not be the right group to post this, but I'm not having much success elsewhere so I thought I'd give it a try... In our application we have a link that opens a new window...
4
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park...
11
by: Dave | last post by:
For some reason, the below lines only work on select machines. All machines are running IE6. IE SP's and OS's vary. When it doesn't work, default.aspx (the page that this code is in) opens and...
5
by: Nicholas | last post by:
Hello, i need to pass an argument to window.open but it seems it wont work. What am i doing wrong? This in in head: <SCRIPT LANGUAGE="JavaScript"> <!-- function nw(a,b){ myWindow =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.