473,574 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript error window.top.main frame 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
Jul 20 '05 #1
4 18838
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.mai nframe 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.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).
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.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 <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.mai nframe 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.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).
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.main frame
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.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>");
The 'mainframe' comes from the menu data itself. E.g.:
it=s0.addItem(2 ,3,4,"Inleiding ",n,n,"","",n,n ,n,"inleiding.h tm","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.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>");


The 'mainframe' comes from the menu data itself. E.g.:
it=s0.addItem(2 ,3,4,"Inleiding ",n,n,"","",n,n ,n,"inleiding.h tm","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
44524
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 hosting provider my webpage menu generates the javascript error:
2
2188
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 problem with some new pages I am creating for the Web site at www.weaverdevore.ca and I am wondering if anyone here might be able to help. Here is...
6
6058
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
1573
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 no problem logging into the forum. But with v. 1.0 I'm getting a javascript error saying "You could not be logged in." When I login from IE I...
3
10403
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... javascript errors :) I can catch errors coming from website that does not use frames using : private void NavigateComplete(object...
1
4261
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()). However, I need to print to the server's printer. I need to print the fully rendered .aspx page from the codebehind .aspx.cs page to the server's...
2
3364
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. When I try to this: window.captureEvents(Event.CLICK); I get a javascript error saying the "Event" is undefined. Here is how I use the code
0
1190
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 have a button that will close the pop-up window, and redirect the parent window with a hyper ref that has a query string in it now, i researched...
3
8638
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 inside the folder "menu_script". The following is the code in this file. var...
0
7728
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8056
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6455
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5301
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3741
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3752
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2247
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.