473,545 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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><ta g>
</div>

<img src="url" onclick="printI t()">

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=documen t.getElementByI d('thecontent') ;

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

//write content var html to the window
w.document.writ e( content.innerHT ML );

//write some javascript to make the newly opened window print itself.
w.document.writ eln("<script>") ;
w.document.writ eln("window.pri nt()");
w.document.writ eln("</"+"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 15985
<html>
<script type="text/javascript">
function printIt()
{
//grab the div in the html w/o the header & footer text
var content=documen t.getElementByI d('thecontent') ;
//open a blank window
w=window.open(' about:blank');
//write content var html to the window
w.document.open ();
w.document.writ e("<html>" + content.innerHT ML);
//write some javascript to make the newly opened window print itself.
w.document.writ eln("<script>wi ndow.print()</"+"script>" );
w.document.writ eln("</html>");
w.document.clos e();
}
</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="printI t()">
</html>

Tim
"dan" <ba************ *@yahoo.com> wrote in message
news:74******** *************** ***@posting.goo gle.com...
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><ta g>
</div>

<img src="url" onclick="printI t()">

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=documen t.getElementByI d('thecontent') ;

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

//write content var html to the window
w.document.writ e( content.innerHT ML );

//write some javascript to make the newly opened window print itself. w.document.writ eln("<script>") ;
w.document.writ eln("window.pri nt()");
w.document.writ eln("</"+"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.ne t> wrote in message news:<J6******* **********@news svr27.news.prod igy.com>...

<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
8297
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 completely loaded and displayed. Likewise, window.navigate. The code looks something like this: wHandle = window.open( url, name, flags ); .... //...
1
2867
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 href=javascript:setCursorPosition(1527,'HATSFORM')>test</a> , which runs the javascript in the current url location, but when I try...
1
1668
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 window to open with a larger version of the image. I want that new window to be customized to the size of the new larger image. Also, when users go...
4
3723
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(){ window.open('xxx.php','xxx','menubar=no,scrollbars=no,resizable=no');
3
2402
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 displaying the contents of a page that can be customized by our end users. When we call window.open() we save the resulting window reference so that if...
4
3586
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 alpha 2) only brings it to the top if the window is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is...
11
4915
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 closes. That's all you see. TSReminder.aspx doesn't even open. I'm not sure what's going on here. Response.Write("<script...
5
8320
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 = window.open("", "Window", 'toolbar,width=a,height=b') //-->
0
7479
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7411
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7926
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7439
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5987
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4962
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.