473,397 Members | 1,950 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,397 software developers and data experts.

Problem with window.close() on popup in IE 5.5

Hi,
There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box.
From a webpage if I open a popup window (window.open()) containing buttons Print and Close.
The functionality is that when i press the "print" button the Print dialog box is opened (window.print();)
and when I click on the close button the popup window is closed (window.close();)

But the problem occurs when
1. The Print button is clicked - print Dialog box is opened.
2. Click Cancel on the Print Dialog button.
3. Click the Close button
The Close button when clicked now does not close the popup window.

This happens only in IE 5.5 whereas it works in IE 5.0, IE 6.0 and all other browser.
Can you please help me in this?
Thx
DB
Expand|Select|Wrap|Line Numbers
  1. function printWindow()
  2.             {
  3.                 bV = parseInt(navigator.appVersion)
  4.                 if (bV >= 4)
  5.                  window.print();
  6.             }
  7. function setPrintedPage(altdoc) 
  8.         {
  9.             var prt;
  10.             var prt = document.getElementsByTagName("link")[0];
  11.             prt.setAttribute("href", altdoc);
  12.             printWindow();
  13.         }
  14.  
  15. <asp:Button id="btnPrint" runat="server" CssClass="ButtonStyle" Text="Print"></asp:Button>
  16. <INPUT class="ButtonStyle" id="btnBack" onclick="self.close();" type="button" value="Close"
  17.                                                 runat="server">
  18.  
  19. btnPrint.Attributes.Add("onclick", "setPrintedPage(url)");
  20.  
Sep 29 '05 #1
1 6925
Niheel
2,460 Expert Mod 2GB
Change the following:

Expand|Select|Wrap|Line Numbers
  1. function printWindow()
  2. {
  3.  bV = parseInt(navigator.appVersion)
  4.  if (bV >= 4)
  5.  window.print();
  6. }
  7. function setPrintedPage(altdoc) 
  8. {
  9.  var prt;
  10.  var prt = document.getElementsByTagName("link")[0];
  11.  prt.setAttribute("href", altdoc);
  12.  printWindow();
  13. }
  14.  
to:
Expand|Select|Wrap|Line Numbers
  1. function printWindow()
  2. {
  3.  bV = parseInt(navigator.appVersion)
  4.  if (bV >= 4)
  5.  window.print();
  6.  window.close();
  7. }
  8. function setPrintedPage(altdoc) 
  9. {
  10.  var prt;
  11.  var prt = document.getElementsByTagName("link")[0];
  12.  prt.setAttribute("href", altdoc);
  13.  printWindow();
  14. }
  15.  
I added the window.close() after the printing is down. Should work, if it doesn't let us know.
Nov 18 '05 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Dennis | last post by:
This may be easy for most but I can't get this thing to work. I believe I followed all the instructions but when I click on the link no window opens just the default IE page cannot display. Here is...
4
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped...
1
by: Bill H | last post by:
I run a dbms application that interfaces with the web. This module creates a frames page with two frames ('main' and 'mwinfoframe'). All communication with the dbms is routed through the...
4
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with...
13
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Jeff | last post by:
I'm hoping that someone can help me. I know little javascript and only need a very small amount in an asp.net application. I have most of it working with one problem. I'm attempting to open a modal...
1
by: YotamElal | last post by:
Hello, I have a popup problem. When a popup is opened, I want all other popups to close immediatly. (except for its self and it's child popups) Here is my code: code: <!DOCTYPE HTML PUBLIC...
2
by: rexdreamer | last post by:
Gotta problem. I have a page that onload a popup window comesup, within that popup window there is a link to another .htm page. I need that link to display the .htm file in the main browser...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.