SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    printing wrong window

    Hi all... first off I will give u the code....

    PHP Code:
       var globalToolbarFlag = -1;
       var 
    globalLastID = -1;
       var 
    globalWindow;

       var 
    flagGlobalSupportedBrowser false;
       var 
    globalBrowserName navigator.appName;
       var 
    globalBrowserVersion parseInt(navigator.appVersion);

    function 
    openWindow(imageNamewinWidthwinHeightBlah) {

       if ( 
    globalBrowserName == "Netscape" && globalBrowserVersion 2) {
          if ( 
    globalWindow ) {
             if ( 
    globalWindow.document ) {
                
    globalWindow.close();
             }
          }
       } else {
          if ( 
    globalBrowserName == "Microsoft Internet Explorer" && globalBrowserVersion 2) {
             if ( 
    globalWindow ) {
                
    globalWindow.close();
             }
          }
       }
       if (
    Blah==1)
       {  
            
    winWidth=winWidth*.9;
       }
        
       
    globalWindow window.open("""PopUp""width=" + (winWidth) + ",height=" + (winHeight) + ",scrollbars=0,toolbar=0,resize=1,location=0,menubar=0")

       
    globalWindow.document.writeln('<HTML>');
       
    globalWindow.document.writeln('<HEAD><title>BC Wine Institute</title></HEAD>');
       
    globalWindow.document.writeln('<BODY BGCOLOR="#FFFFFF" link="black" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>');
       
    globalWindow.document.writeln('<CENTER>\n');
       if (
    Blah==1)
       {
            
    winHeight=winHeight*.95;
       }
       
    globalWindow.document.writeln('<IMG SRC="' imageName '" WIDTH=' winWidth ' HEIGHT=' winHeight '><BR>');
       
       if (
    Blah==1)
       {
            
    globalWindow.document.writeln('<font face=arial size=2><a href="javascript:window.print();">Click here to Print or hold "Ctrl" and press "P"</a>');
       }
       
    globalWindow.document.writeln('</CENTER>\n');
       
    globalWindow.document.writeln('</BODY>');
       
    globalWindow.document.writeln('</HTML>');

       return;


    What it does is open a window, and if 'Blah' is passed, it displays a little print link button on the bottom of the popup, problem ishte print link is printing the main window, not the pop-up
    thanx

  2. #2
    SitePoint Enthusiast slp's Avatar
    Join Date
    May 2001
    Location
    Australia
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I once had virtually the same problem with some javascript. I'd say to try adding:
    globalWindow.document.close()
    after your line: ***globalWindow.document.writeln('</HTML>');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •