473,398 Members | 2,525 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,398 software developers and data experts.

null or not an object using frames

I have a site that is supposed to be 'real-time' which has a frameset
of 2 rows (the bottom row is 1 pixel so essentially invisible to IE
users which is the requirement for the product). The bottom frame
refreshes using an http-refresh every 15 seconds. If new data is
available on the server, it tells the top page to refresh. For checks
and balances, the top frame has a form at the bottom of the page with a
'clockBox'..which is essentially a text box that gets updated every
second so it looks like a timer. When the bottom frame refreshes, it
waits 5 seconds then resets the top counter to 0. The top counter
continues to count. If the top counter gets to 30 (which it never
should unless the bottom frame gets stuck), it refreshes the bottom
frame.

My problem:
When the top frame is taking too long to load, I get a javascript
error:
Error: 'window.parent.frames.body.coutnerFomr.clockBox' is null or not
an object.

Here's my code:

<script language="javascript">
timer = setTimeout("setCounter()",8000);
function setCounter(){
if (window.parent.frames["body"].counterForm.clockBox){
window.parent.frames["body"].counterForm.clockBox.value = 0;
}
}
</script>

Jul 23 '05 #1
1 5938

Phoenix <ph*********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I have a site that is supposed to be 'real-time' which has a frameset
of 2 rows (the bottom row is 1 pixel so essentially invisible to IE
users which is the requirement for the product). The bottom frame
refreshes using an http-refresh every 15 seconds. If new data is
available on the server, it tells the top page to refresh. For checks
and balances, the top frame has a form at the bottom of the page with a
'clockBox'..which is essentially a text box that gets updated every
second so it looks like a timer. When the bottom frame refreshes, it
waits 5 seconds then resets the top counter to 0. The top counter
continues to count. If the top counter gets to 30 (which it never
should unless the bottom frame gets stuck), it refreshes the bottom
frame.

My problem:
When the top frame is taking too long to load, I get a javascript
error:
Error: 'window.parent.frames.body.coutnerFomr.clockBox' is null or not
an object.

Here's my code:

<script language="javascript">
timer = setTimeout("setCounter()",8000);
function setCounter(){
if (window.parent.frames["body"].counterForm.clockBox){
window.parent.frames["body"].counterForm.clockBox.value = 0;
}
}
</script>


I suspect that's because window.parent.frames["body"].counterForm.clockBox
cannot be an object until window.parent.frames["body"] is loaded.

Instead of waiting a fixed time, it may be better to monitor continuously
until the other frame's document is loaded.

[Not tested]

timer = setInterval("setCounter()",500);

function setCounter()
{
if (window.parent.frames["body"] &&
window.parent.frames["body"].counterForm.clockBox)
{
clearInterval(timer);
window.parent.frames["body"].counterForm.clockBox.value = 0;
}
}

--
S.C.
Jul 23 '05 #2

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

Similar topics

4
by: Erik-Jan Bakker | last post by:
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...
4
by: Geoff Cox | last post by:
Hello, One person to date has received a runtime error message saying "parent.frameleft.location is not an object" with the following code. The code is used to select 2 frames at the same...
5
by: Jim Marquardson | last post by:
Hi, I've struggled with this for a while now, so I'm asking for help. I am trying to click on a link in one page, have that link open up in a new window, and set that newly opened window's...
3
by: bdogsputnik | last post by:
I'm getting the following error: brian.style is null or not an object on the following code...can anyone help? <html> <head> <script> <!-- function brianIt(){
12
by: marcadonis | last post by:
Hi! Does anybody know of a way that I can keep a reference to an object that I can then reuse? I tried various approaches using navigator, but these all fail in an iframe due to premission...
14
by: Cylix | last post by:
I have a array to store some student information, eg var s = new Array('2006001', 'Apple Joker', '5B'); normally, We get the data using s, s,s ... How can I define them more readable like s, s,...
3
by: Webnewsreader | last post by:
Hi,I have a webbrowser object with two frames with similar source code<frameset cols="230,*"> <frame name="frame1" target="frm1" src="teste1.php?var=123"> <frame name="frame2" target="_blank"...
5
by: helraizer1 | last post by:
Me again :D You're going to be sick of me soon. =P I found the GifEncoder class on phpclasses, which creates an animated gif image from frames and echos it to the browser to show; can also save...
1
by: John L. | last post by:
How do I invoke the scroll() method of a window object for a scrollable IFRAME element in an HTML document? I am using IE 7.0, and I thought the following would work: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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...
0
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,...
0
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
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
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,...

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.