473,614 Members | 2,089 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 18842
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
44525
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
2193
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 a full description of the problem:
6
6060
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
1574
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 don't have this problem. I've posted in this forum & the Firefox forum asking whether others have...
3
10404
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 sender,AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) {
1
4270
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 printer. I've tried using SHDocVw.InternetExplorer and SHDocVw.WebBrowser but I just can't seem...
2
3368
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
1195
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 this and i go <script language=javascript>
3
8639
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 menuOffsetTop=menuOffsetLeft=submenuOffsetTop=submenuOffsetLeft=submenuOffsetRight=0; var Doc=this.document;var standards=Doc.createElement&&Doc.createTextNode?1:0;...
0
8182
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8627
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8579
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8279
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8433
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7093
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5540
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4052
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1425
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.