Help with opening a window in Netscape

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Athiest

    #1

    Help with opening a window in Netscape

    Hi,

    I have the following JavaScript function which works fine in IE, Opera and
    Firefox. I can't get it to work in Netscape 7.2

    Here is the code:

    /*************** *************** *************** *****/
    /* Display a popup window centered on the screen. */
    /* Width and Height are supplied by the caller. * /
    /*************** *************** *************** *****/
    var win= null;
    function newWindow(mypag e,myname,w,h,sc roll) {
    var winl = (screen.availWi dth-w)/2;
    var wint = (screen.availHe ight-h)/2;
    var settings ='height='+h+', ';
    settings +='width='+w+', ';
    settings +='top='+wint+' ,';
    settings +='left='+winl+ ',';
    settings +='scrollbars=' +scroll+',';
    settings +='resizable=ye s';
    win=window.open (mypage,myname, settings);
    if (parseInt(navig ator.appVersion ) >= 4) {
    win.focus();
    }
    if (!win.opener) {
    win.opener = self;
    }

    return win;
    }

    1. I get the following error when I click on a link which attempts to open
    the window:
    "win has no properties"

    2. When I comment out the two if statements at the bottom of the function, I
    do not get an error but nothing happens (no window).

    Any ideas?

    Thanks,
    Don


  • Lee

    #2
    Re: Help with opening a window in Netscape

    The Athiest said:[color=blue]
    >
    >Hi,
    >
    >I have the following JavaScript function which works fine in IE, Opera and
    >Firefox. I can't get it to work in Netscape 7.2
    >
    >
    >1. I get the following error when I click on a link which attempts to open
    >the window:
    >"win has no properties"[/color]


    When I copy that code to a page and call it with the following button,
    it works just fine in Netscape 7.2. What are you doing differently?

    <button
    onclick="newWin dow('http://www.google.com' ,'gwin',600,400 ,1)">Google</button>

    Comment

    • Ian Sedwell

      #3
      Re: Help with opening a window in Netscape

      Hi Dan

      Try something like this... I had a similar problem, but not with N7.2... DU
      very kindly helped out and my solution is based on the pointers he gave me.
      It works for me!

      var flightDetailsWi ndow = null;

      function displayFlightDe tails () {
      var theURL = "framedetail.ht m";
      var pageName = "flightdetail.h tm";
      var winName = "Flight_Detail" ;
      var winHeight = 500;
      var features = "scrollbars=no, ";

      if (screen.height <= 480) {
      features += "scrollbars=yes ,";
      winHeight = screen.height - 100;
      }

      features += "toolbar=no ,";
      features += "menuBar=no ,";
      features += "directories=no ,";
      features += "status=no, ";
      features += "resizable=no," ;
      features += "width=500, ";
      features += "height=" + winHeight + ",";
      features += "left=30,";
      features += "top=30";

      flightDetailsWi ndow =
      openDisplayWind ow(flightDetail sWindow,theURL, winName,feature s);

      writeDetailsCon tent(flightDeta ilsWindow,winNa me,pageName);
      }

      function openDisplayWind ow (windowRef,cont entURL,windowNa me,features) {
      if ((windowRef == null) || (windowRef.clos ed)) {
      windowRef = window.open(con tentURL,windowN ame,features);
      }
      else {
      windowRef.focus ();
      }

      return windowRef;
      }


      On 2004/09/06 02:52, in article
      apP_c.218080$UT P.97802@twister 01.bloor.is.net .cable.rogers.c om, "The
      Athiest" <athiest.nospam @nodomain.com> wrote:
      [color=blue]
      > Hi,
      >
      > I have the following JavaScript function which works fine in IE, Opera and
      > Firefox. I can't get it to work in Netscape 7.2
      >
      > Here is the code:
      >
      > /*************** *************** *************** *****/
      > /* Display a popup window centered on the screen. */
      > /* Width and Height are supplied by the caller. * /
      > /*************** *************** *************** *****/
      > var win= null;
      > function newWindow(mypag e,myname,w,h,sc roll) {
      > var winl = (screen.availWi dth-w)/2;
      > var wint = (screen.availHe ight-h)/2;
      > var settings ='height='+h+', ';
      > settings +='width='+w+', ';
      > settings +='top='+wint+' ,';
      > settings +='left='+winl+ ',';
      > settings +='scrollbars=' +scroll+',';
      > settings +='resizable=ye s';
      > win=window.open (mypage,myname, settings);
      > if (parseInt(navig ator.appVersion ) >= 4) {
      > win.focus();
      > }
      > if (!win.opener) {
      > win.opener = self;
      > }
      >
      > return win;
      > }
      >
      > 1. I get the following error when I click on a link which attempts to open
      > the window:
      > "win has no properties"
      >
      > 2. When I comment out the two if statements at the bottom of the function, I
      > do not get an error but nothing happens (no window).
      >
      > Any ideas?
      >
      > Thanks,
      > Don
      >
      >[/color]

      Comment

      Working...