javascript error window.top.mainframe is null or not an object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Erik-Jan Bakker

    javascript error window.top.mainframe is null or not an object

    Hi

    I am not a javascript expert and I have a problem that the guru's
    in this newsgroup probably can solve quickly. ;-)

    I've made a webpage with three frames: top, left and mainframe.
    I defined this in a frameset called index.htm.
    Each frame is loaded with a specific page: top:title.htm, left:menu.htm
    and mainframe:start .htm.
    So far so good...

    In menu.htm I have a javascript compiled menubar. Each menu button
    reffering to a page to load in the mainframe.
    When I tested my webpage on my own PC (I start with index.htm) everything
    works fine.
    When I upload the webpage to my host provider and approach the index.htm
    the page is loaded correctly and the javascript menu buttons appears correctly.
    But when I click on one of the menu button I got the message Error in Page:

    "window.top.mai nframe is null or not an object"

    It looks like that the frameset definition is loaded after the javascript.
    But I alreasdy put the javascript at the end of the source code of menu.htm
    on purpose.

    How can I solve this problem?
    Why don't I have this problem on my own PC?
    How can I force that the object mainframe is defined in the javascript source?

    I hope there's someone here to help me out with some hints, tips or tricks.

    Erik-Jan
  • Lasse Reichstein Nielsen

    #2
    Re: javascript error window.top.main frame is null or not an object

    ebak123@erik-jan.net (Erik-Jan Bakker) writes:
    [color=blue]
    > When I upload the webpage to my host provider and approach the
    > index.htm the page is loaded correctly and the javascript menu
    > buttons appears correctly.[/color]
    [color=blue]
    > But when I click on one of the menu button I got the message Error in Page:
    >
    > "window.top.mai nframe is null or not an object"[/color]

    Which provider do you use? Do you have a redirection service?

    Some free web providers put frames around your pages, and some
    redirectors are simply one big frame with your page inside it.
    In both cases, "top" will not refer to your frameset, but to theirs.

    Directing my browser to "erik-jan.net" shows a single redirection
    frame pointing to "internl.ne t/users/ejbakker" (which doesn't exist).

    Try changing the offending line from "window.top.mai nframe" to
    "parent.fra mes['mainframe']" (I prefer to use the explicit name
    for the frames collection, but "parent.mainfra me" probably works
    too in most browsers).
    [color=blue]
    > It looks like that the frameset definition is loaded after the javascript.[/color]

    Impossible, if the frame running the javascript is in a frame inside
    the frameset.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Erik-Jan Bakker

      #3
      Re: javascript error window.top.main frame is null or not an object

      Lasse thnaks for your reply.
      My provider is zonnet.nl but it isn't a free one.
      Indeed I am using a redirection service (zoneedit.com).
      As far as I know, they don't use one big frame with my page in it.
      It's simply a name record in DNS.

      By the way "erik-jan.net" doesn't exist anymore. is an old redirection
      which I forgot to delete.
      My problem is with another domain name (www.laurenskamerkoor.net)
      It's temporary offline now.

      I have made my menu with AllWebMenus Pro
      When I look in the source I cannot find the line window.top.main frame
      so I don't know where to change it in parent.frames['mainframe']"

      This is the source code:

      //----------DHTML Menu Created using AllWebMenus PRO ver
      3.1-#500---------------
      var awmMenuName='lk kmenu';
      var awmLibraryPath= '/awmData-lkkmenu';
      var awmImagesPath='/awmData-lkkmenu';
      var awmSupported=(n avigator.appNam e +
      navigator.appVe rsion.substring (0,1)=="Netscap e5" || document.all ||
      document.layers || navigator.userA gent.indexOf('O pera')>-1)?1:0;
      if (awmAltUrl!='' && !awmSupported)
      window.location .replace(awmAlt Url);
      if (awmSupported){
      var awmMenuPath;
      if (document.all) mpi=document.al l['awmMenuPathImg-lkkmenu'].src;
      if (document.layer s)
      mpi=document.im ages['awmMenuPathImg-lkkmenu'].src;
      if (navigator.appN ame +
      navigator.appVe rsion.substring (0,1)=="Netscap e5" ||
      navigator.userA gent.indexOf('O pera')>-1)
      mpi=document.ge tElementById('a wmMenuPathImg-lkkmenu').src;
      awmMenuPath=mpi .substring(0,mp i.length-16);
      var nua=navigator.u serAgent,script No=(nua.indexOf ('Gecko')>-1)?2:((document .layers)?3:((nu a.indexOf('Oper a')>-1)?4:((nua.inde xOf('Mac')>-1)?5:1)));
      document.write( "<SCRIPT
      SRC='"+awmMenuP ath+awmLibraryP ath+"/awmlib"+scriptN o+".js'><\/SCRIPT>");
      var n=null;
      awmzindex=1000;
      }

      var awmSubmenusFram e='mainframe';
      var awmSubmenusFram eOffset;
      var awmOptimize=0;
      function awmBuildMenu(){
      if (awmSupported){
      awmImagesColl=['lkk-sub.gif',10,10, 'lkk-sub2.gif',10,10];
      awmCreateCSS(1, 2,1,'#B6DFF5',' #000F82',n,'bol d 14px
      Arial',n,'none' ,1,n,2,0)
      awmCreateCSS(0, 1,0,n,'#000F82' ,n,n,n,'outset' ,2,'#C0C0C0',0, 0);
      awmCreateCSS(1, 2,1,'#000F82',' #B6DFF5',n,'bol d 14px
      Arial',n,'none' ,1,n,2,1)
      awmCreateCSS(0, 2,1,'#B6DFF5',' #000F82',n,'bol d 14px
      Arial',n,'none' ,1,n,2,1)
      awmCreateCSS(0, 2,1,'#FFFFFF',' #7A96DF',n,'bol d 14px
      Arial',n,'none' ,1,n,2,1)
      awmCreateCSS(1, 2,1,'#000F82',' #B6DFF5',n,'bol d 14px
      Arial',n,'none' ,1,n,2,0)
      awmCreateCSS(0, 2,1,'#B6DFF5',' #000F82',n,'bol d 14px
      Arial',n,'none' ,1,n,2,0)
      awmCreateCSS(0, 2,1,'#FFFFFF',' #7A96DF',n,'bol d 14px
      Arial',n,'none' ,1,n,2,0)
      var s0=awmCreateMen u(0,0,0,6,1,0,0 ,5,0,1,23,0,0,1 ,0,"&nbsp&nbsp
      Laurens Kamerkoor &nbsp","",n,1,1 ,1,0,n,n);
      it=s0.addItem(2 ,3,4,"Inleiding ",n,n,"","",n,n ,n,"inleiding.h tm","mainframe" );
      it=s0.addItem(2 ,3,4,"Koorleden ",n,n,"","",n,n ,n,"koorleden.h tm","mainframe" );
      it=s0.addItem(2 ,3,4,"Repertoir e",n,n,"","",n, n,n,"repertoire .htm","mainfram e");
      it=s0.addItemWi thImages(5,6,7, "Nieuws",n,n,"" ,n,n,n,0,0,0,0, 1,n,"",n,n,n,n, n);
      it=s0.addItem(2 ,3,4,"Links",n, n,"","",n,n,n," links.htm","mai nframe");
      it=s0.addItem(2 ,3,4,"Gastenboe k",n,n,"","",n, n,n,"gastenboek .htm","mainfram e");
      it=s0.addItem(2 ,3,4,"Contact", n,n,"","",n,n,n ,"contact.htm", "mainframe" );
      it=s0.addItem(2 ,3,4,"Inloggen" ,n,n,"","",n,n, n,"inloggen.htm ","mainfram e");
      s0.pm.buildMenu ();
      }}


      Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<k779s2dx. fsf@hotpop.com> ...[color=blue]
      > ebak123@erik-jan.net (Erik-Jan Bakker) writes:
      >[color=green]
      > > When I upload the webpage to my host provider and approach the
      > > index.htm the page is loaded correctly and the javascript menu
      > > buttons appears correctly.[/color]
      >[color=green]
      > > But when I click on one of the menu button I got the message Error in Page:
      > >
      > > "window.top.mai nframe is null or not an object"[/color]
      >
      > Which provider do you use? Do you have a redirection service?
      >
      > Some free web providers put frames around your pages, and some
      > redirectors are simply one big frame with your page inside it.
      > In both cases, "top" will not refer to your frameset, but to theirs.
      >
      > Directing my browser to "erik-jan.net" shows a single redirection
      > frame pointing to "internl.ne t/users/ejbakker" (which doesn't exist).
      >
      > Try changing the offending line from "window.top.mai nframe" to
      > "parent.fra mes['mainframe']" (I prefer to use the explicit name
      > for the frames collection, but "parent.mainfra me" probably works
      > too in most browsers).
      >[color=green]
      > > It looks like that the frameset definition is loaded after the javascript.[/color]
      >
      > Impossible, if the frame running the javascript is in a frame inside
      > the frameset.
      >
      > /L[/color]

      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: javascript error window.top.main frame is null or not an object

        ebak123@erik-jan.net (Erik-Jan Bakker) writes:
        [color=blue]
        > My problem is with another domain name (www.laurenskamerkoor.net)
        > It's temporary offline now.[/color]
        [color=blue]
        > I have made my menu with AllWebMenus Pro
        > When I look in the source I cannot find the line window.top.main frame
        > so I don't know where to change it in parent.frames['mainframe']"[/color]

        It is probably on one of the browser dependent files. If you use IE,
        the file is "awmlib1.js ". There are files from 1 to 5, number 2 is
        Gecko, 3 is Netscape 4, 4 is Opera and 5 is something else on a
        Macintosh (IE or Safari, although it probably assumes it is IE because
        it doesn't know Safari).

        The file is loaded here:
        [color=blue]
        > var nua=navigator.u serAgent,script No=(nua.indexOf ('Gecko')>-1)?2:((document .layers)?3:((nu a.indexOf('Oper a')>-1)?4:((nua.inde xOf('Mac')>-1)?5:1)));
        > document.write( "<SCRIPT
        > SRC='"+awmMenuP ath+awmLibraryP ath+"/awmlib"+scriptN o+".js'><\/SCRIPT>");[/color]

        The 'mainframe' comes from the menu data itself. E.g.:
        [color=blue]
        > it=s0.addItem(2 ,3,4,"Inleiding ",n,n,"","",n,n ,n,"inleiding.h tm","mainframe" );[/color]

        Last argument is probably the frame.

        The means that you should search for "window.top " in the browser
        dependent files.

        Or, more probable, you can read the documentation for AllWebMenus and
        see where you set the frame path to the target frame.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • Erik-Jan Bakker

          #5
          Re: javascript error window.top.main frame is null or not an object

          Lasse, thanks!

          My problem is solved. It was indeed one of the browser dependent files.
          I've repalced in all files awmlibx.js (1 to 7) window.top with parent.
          Now it works fine!

          But I still don't understand why I didn't have a problem on my own PC?


          Lasse Reichstein Nielsen <lrn@hotpop.com > wrote in message news:<u16crkft. fsf@hotpop.com> ...[color=blue]
          >
          > It is probably on one of the browser dependent files. If you use IE,
          > the file is "awmlib1.js ". There are files from 1 to 5, number 2 is
          > Gecko, 3 is Netscape 4, 4 is Opera and 5 is something else on a
          > Macintosh (IE or Safari, although it probably assumes it is IE because
          > it doesn't know Safari).
          >
          > The file is loaded here:
          >[color=green]
          > > var nua=navigator.u serAgent,script No=(nua.indexOf ('Gecko')>-1)?2:((document .layers)?3:((nu a.indexOf('Oper a')>-1)?4:((nua.inde xOf('Mac')>-1)?5:1)));
          > > document.write( "<SCRIPT
          > > SRC='"+awmMenuP ath+awmLibraryP ath+"/awmlib"+scriptN o+".js'><\/SCRIPT>");[/color]
          >
          > The 'mainframe' comes from the menu data itself. E.g.:
          >[color=green]
          > > it=s0.addItem(2 ,3,4,"Inleiding ",n,n,"","",n,n ,n,"inleiding.h tm","mainframe" );[/color]
          >
          > Last argument is probably the frame.
          >
          > The means that you should search for "window.top " in the browser
          > dependent files.
          >
          > Or, more probable, you can read the documentation for AllWebMenus and
          > see where you set the frame path to the target frame.
          >
          > /L[/color]

          Comment

          Working...