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

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

P: 1
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
Share this Question
Share on Google+
1 Reply


Expert Mod 100+
P: 2,327
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

Post your reply

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