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 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/
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/
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
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
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
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
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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
...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |