473,509 Members | 4,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checking for a page section

I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:

'parent.frmUpper.document' is null or is not an object

I would like to know if there is a way to check for the existence of an
object by name so I can determine what to do next.

Thanks for suggestions.

J

Dec 27 '06 #1
7 1213
javelin wrote:
I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:

'parent.frmUpper.document' is null or is not an object

I would like to know if there is a way to check for the existence of an
object by name so I can determine what to do next.
if (window != parent)
checks wether your code is run in frame window.
If you want to check for that particular frame sibling then do e.g.
if (parent.frames && parent.frames.frmUpper &&
parent.frames.frmUpper.document) {
// no access something in parent.frames.frmUpper.document
}
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 27 '06 #2
Thanks for the quick response, Martin. I may have asked the wrong
question. I tried checking wither or not the window was equal to
parent, and it still ran the next line, so I tried "if
(parent=='frmUpper')", and it did not run this code. I've tried other
screens that apparently required this code, and they work well enough,
but can you tell me if the code makes sense, or am I asking for
trouble?

Thanks again.
Martin Honnen wrote:
javelin wrote:
I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:

'parent.frmUpper.document' is null or is not an object

I would like to know if there is a way to check for the existence of an
object by name so I can determine what to do next.

if (window != parent)
checks wether your code is run in frame window.
If you want to check for that particular frame sibling then do e.g.
if (parent.frames && parent.frames.frmUpper &&
parent.frames.frmUpper.document) {
// no access something in parent.frames.frmUpper.document
}
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 27 '06 #3
ASM
javelin a écrit :
I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:

'parent.frmUpper.document' is null or is not an object
could try :

function origine(what) {
what = parent.what? parent.what : self;
return what;
}

or :

function origine(what) {
return parent==self? window : parent.what;
}

origine('frmUpper').document;
(not tested)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 27 '06 #4
Thanks so much for the response. I'm going to play with this to see
what results of it.

ASM wrote:
javelin a écrit :
I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:

'parent.frmUpper.document' is null or is not an object

could try :

function origine(what) {
what = parent.what? parent.what : self;
return what;
}

or :

function origine(what) {
return parent==self? window : parent.what;
}

origine('frmUpper').document;
(not tested)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 27 '06 #5
Using the "what" property did not work for me. I finally solved this
challenge by using a try/catch method. If the try fails, the catch does
nothing, and this works out perfectly.

Thanks for all the responses.

javelin wrote:
Thanks so much for the response. I'm going to play with this to see
what results of it.

ASM wrote:
javelin a écrit :
I have inherited a project with some code that runs fine for some
frames but not for others. This is a frames based project, and
(apparently) sometimes there is a parent frame, and sometimes not. When
there is no parent frame, you see this error message:
>
'parent.frmUpper.document' is null or is not an object
could try :

function origine(what) {
what = parent.what? parent.what : self;
return what;
}

or :

function origine(what) {
return parent==self? window : parent.what;
}

origine('frmUpper').document;
(not tested)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 27 '06 #6
ASM
javelin a écrit :
Using the "what" property did not work for me.
this here works :

function origine(what) {
return parent==self? window : parent.frames[what];
}

>>origine('frmUpper').document;

(tested in Firefox)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 28 '06 #7
Just getting back to this now. Yes, that did work. Thanks so very much.

ASM wrote:
javelin a écrit :
Using the "what" property did not work for me.

this here works :

function origine(what) {
return parent==self? window : parent.frames[what];
}

>origine('frmUpper').document;


(tested in Firefox)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jan 4 '07 #8

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

Similar topics

7
1879
by: |-|erc | last post by:
<?php if ((!isset($s)) && (!isset($msg))) { echo("<table> .... I want some pictures displayed on the main page if its a new visit, but when they search and the url bar changes its skips...
0
2406
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
6
3654
by: Flip | last post by:
I'm reading the O'Reilly's Progamming C# book and I have a question about array bounds checking. On page 174, near the top, they show an example where c# does indeed to array bounds checking cause...
4
1277
by: darrel | last post by:
Karl has helped me in the past in regards to communicating between controls and pages: http://www.openmymind.net/communication/index.html#3.1 I ended up going down the interfaces path and...
1
8552
by: Tim Frawley | last post by:
I have created a Crystal Report with five subreports to represent datagrids on our dataentry application. The largest datagrid is the last item on the report. When empty this last subreport will...
0
1686
by: Arnold | last post by:
Hi Everyone; In a report, I've essentially recreated a paper sheet by adding various labels--name, date, problem, year, Progress Notes, etc.--and horizontal lines (people have traditionally...
13
14893
by: Greg | last post by:
Most suggestions on this topic recommend to use a page footer and make it visible only on the last page. My problem is that the footer is half of the height of a page which means the detail would...
1
1942
by: cheyennemtnman | last post by:
In MS Access how can I skip to the next page on section break if section can not be printed entirely on the preceding page. Say if I had 20 print lines on the page and I have section 1 with 4...
10
1741
by: =?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
Over on comp.lang.c++, we were dicussing the replacment of: if (expr) Func(); with: expr && Func(); My own initial reaction was that, if I saw the latter in code, I'd say the programmer...
0
7237
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,...
0
7416
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...
1
7073
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...
0
7506
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...
0
5656
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,...
0
4732
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...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
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 ...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.