473,804 Members | 3,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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'..whi ch 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.cou tnerFomr.clockB ox' is null or not
an object.

Here's my code:

<script language="javas cript">
timer = setTimeout("set Counter()",8000 );
function setCounter(){
if (window.parent. frames["body"].counterForm.cl ockBox){
window.parent.f rames["body"].counterForm.cl ockBox.value = 0;
}
}
</script>

Jul 23 '05 #1
1 5971

Phoenix <ph*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.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'..whi ch 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.cou tnerFomr.clockB ox' is null or not
an object.

Here's my code:

<script language="javas cript">
timer = setTimeout("set Counter()",8000 );
function setCounter(){
if (window.parent. frames["body"].counterForm.cl ockBox){
window.parent.f rames["body"].counterForm.cl ockBox.value = 0;
}
}
</script>


I suspect that's because window.parent.f rames["body"].counterForm.cl ockBox
cannot be an object until window.parent.f rames["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("se tCounter()",500 );

function setCounter()
{
if (window.parent. frames["body"] &&
window.parent.f rames["body"].counterForm.cl ockBox)
{
clearInterval(t imer);
window.parent.f rames["body"].counterForm.cl ockBox.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
18878
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 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...
4
4126
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 time... Any ideas why please? Geoff
5
4221
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 ifram to a specific url. Here is the code I'm using: <html> <head>
3
10728
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
5410
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 problems. For e.g.: navigator.stuff = 5;
14
1712
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, s ? Thank you
3
2250
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" src="teste2.php?var=456"> </frameset>now the problem.At frame "frame1" there are several links that I want to "click" or open in "frame2" using some coding"frame1" source sample:<a href='pagina1.php?sessao=123' target='frame2'>Pagina1</a><a...
5
3428
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 it as an image with .gif extension. The only problem is that I need to add the animated gif onto another image (with imagecopymerge), however the gif image that is returned by this code in an object. Here is the code: GifEncoder.Class.php
1
3173
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: document.frame01.scroll(x,y) or possibly document.getElementById('frame01').scroll(x,y)
0
9579
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10326
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
10317
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
10075
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
9143
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...
1
7615
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
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.