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

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.mainframe 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
Jul 20 '05 #1
4 18802
eb*****@erik-jan.net (Erik-Jan Bakker) writes:
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.mainframe is null or not an object"
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.net/users/ejbakker" (which doesn't exist).

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


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

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
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.mainframe
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='lkkmenu';
var awmLibraryPath='/awmData-lkkmenu';
var awmImagesPath='/awmData-lkkmenu';
var awmSupported=(navigator.appName +
navigator.appVersion.substring(0,1)=="Netscape5" || document.all ||
document.layers || navigator.userAgent.indexOf('Opera')>-1)?1:0;
if (awmAltUrl!='' && !awmSupported)
window.location.replace(awmAltUrl);
if (awmSupported){
var awmMenuPath;
if (document.all) mpi=document.all['awmMenuPathImg-lkkmenu'].src;
if (document.layers)
mpi=document.images['awmMenuPathImg-lkkmenu'].src;
if (navigator.appName +
navigator.appVersion.substring(0,1)=="Netscape5" ||
navigator.userAgent.indexOf('Opera')>-1)
mpi=document.getElementById('awmMenuPathImg-lkkmenu').src;
awmMenuPath=mpi.substring(0,mpi.length-16);
var nua=navigator.userAgent,scriptNo=(nua.indexOf('Gec ko')>-1)?2:((document.layers)?3:((nua.indexOf('Opera')>-1)?4:((nua.indexOf('Mac')>-1)?5:1)));
document.write("<SCRIPT
SRC='"+awmMenuPath+awmLibraryPath+"/awmlib"+scriptNo+".js'><\/SCRIPT>");
var n=null;
awmzindex=1000;
}

var awmSubmenusFrame='mainframe';
var awmSubmenusFrameOffset;
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,'bold 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,'bold 14px
Arial',n,'none',1,n,2,1)
awmCreateCSS(0,2,1,'#B6DFF5','#000F82',n,'bold 14px
Arial',n,'none',1,n,2,1)
awmCreateCSS(0,2,1,'#FFFFFF','#7A96DF',n,'bold 14px
Arial',n,'none',1,n,2,1)
awmCreateCSS(1,2,1,'#000F82','#B6DFF5',n,'bold 14px
Arial',n,'none',1,n,2,0)
awmCreateCSS(0,2,1,'#B6DFF5','#000F82',n,'bold 14px
Arial',n,'none',1,n,2,0)
awmCreateCSS(0,2,1,'#FFFFFF','#7A96DF',n,'bold 14px
Arial',n,'none',1,n,2,0)
var s0=awmCreateMenu(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,"i nleiding.htm","mainframe");
it=s0.addItem(2,3,4,"Koorleden",n,n,"","",n,n,n,"k oorleden.htm","mainframe");
it=s0.addItem(2,3,4,"Repertoire",n,n,"","",n,n,n," repertoire.htm","mainframe");
it=s0.addItemWithImages(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","mainframe");
it=s0.addItem(2,3,4,"Gastenboek",n,n,"","",n,n,n," gastenboek.htm","mainframe");
it=s0.addItem(2,3,4,"Contact",n,n,"","",n,n,n,"con tact.htm","mainframe");
it=s0.addItem(2,3,4,"Inloggen",n,n,"","",n,n,n,"in loggen.htm","mainframe");
s0.pm.buildMenu();
}}
Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<k7**********@hotpop.com>...
eb*****@erik-jan.net (Erik-Jan Bakker) writes:
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.mainframe is null or not an object"


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.net/users/ejbakker" (which doesn't exist).

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


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

/L

Jul 20 '05 #3
eb*****@erik-jan.net (Erik-Jan Bakker) writes:
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.mainframe
so I don't know where to change it in parent.frames['mainframe']"
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:
var nua=navigator.userAgent,scriptNo=(nua.indexOf('Gec ko')>-1)?2:((document.layers)?3:((nua.indexOf('Opera')>-1)?4:((nua.indexOf('Mac')>-1)?5:1)));
document.write("<SCRIPT
SRC='"+awmMenuPath+awmLibraryPath+"/awmlib"+scriptNo+".js'><\/SCRIPT>");
The 'mainframe' comes from the menu data itself. E.g.:
it=s0.addItem(2,3,4,"Inleiding",n,n,"","",n,n,n,"i nleiding.htm","mainframe");


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 - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4
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 <lr*@hotpop.com> wrote in message news:<u1**********@hotpop.com>...

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:
var nua=navigator.userAgent,scriptNo=(nua.indexOf('Gec ko')>-1)?2:((document.layers)?3:((nua.indexOf('Opera')>-1)?4:((nua.indexOf('Mac')>-1)?5:1)));
document.write("<SCRIPT
SRC='"+awmMenuPath+awmLibraryPath+"/awmlib"+scriptNo+".js'><\/SCRIPT>");


The 'mainframe' comes from the menu data itself. E.g.:
it=s0.addItem(2,3,4,"Inleiding",n,n,"","",n,n,n,"i nleiding.htm","mainframe");


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

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Erik-Jan Bakker | last post by:
Hello, I am stuck with a weird javascript problem.... ;-( Maybe it's somehting very simple, but I am really stuck in it, right now. What's the matter.... When place my website at a different...
2
by: TeknoCat | last post by:
Hey everyone, I may be repeating myself here, but if someone sent a reply then I missed it, and I can't get Outlook Express to download any messages more than 2 days old. Anyway, I'm having a...
6
by: Chris | last post by:
Can anyone point me to some code that will display messages, in a seperate window, from javascipt. ie effectively a trace window? TIA Chris
6
by: Richard Silverstein | last post by:
I'm a member of a forum sponsored by jasc.com ( http://forums.jasc.com/ ) which uses Webboard software. I use Firefox 1.0 (final release) as my browser. When I used previous versions of FF I had...
3
by: dricks dr | last post by:
Hi, I'm using the AxWebBrowser Control from microsoft in a C# application. It works fine, but i have many problems to hide the javascript error windows that appear when u visit a website with......
1
by: Robin Dindayal | last post by:
Does anyone know how I can print a fully rendered .aspx to the server's printer? I know that, if I wanted to print to the client's printer it would be easy (ie. use javascript's window.print()). ...
2
by: harry | last post by:
Hi I am trying to add an event handler to the window so that If the user clicks the close window button, it creates a popup to tell the user it should use the log out button before closing window....
0
by: semesm22 | last post by:
hey all, i am using javascript with ASP.NET, and i what i have done is open up a small pop-up window from a Calendar control that will display the date the user selected....now what i need to do is...
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.