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

multi iframe or div refresh

Bob
Hi All,

Is the following possible, and if so could someone show me some example code
please :o)

I have a web page with several iframes, and I want to be able to refresh
them only not the entire web page but also to refresh them at different time
intervals. I've tried a few ways but it ends up refreshing the entire page,
doh. I've tried with DIV's and objects aswell but no joy, I'm sure it must
be possible and I'm been a thicket ;o)

Any ideas?
Thanks in advance,
Rob

May 1 '06 #1
6 11060
Bob said the following on 5/1/2006 8:39 AM:
Hi All,

Is the following possible, and if so could someone show me some example code
please :o)
Is it possible for you not to post the same question twice in under 120
seconds?
I have a web page with several iframes, and I want to be able to refresh
them only not the entire web page but also to refresh them at different time
intervals. I've tried a few ways but it ends up refreshing the entire page,
doh. I've tried with DIV's and objects aswell but no joy, I'm sure it must
be possible and I'm been a thicket ;o)
window.frames['IFrameName'].reload()
Any ideas?


Yeah, lots of them. But most aren't fit for a family oriented NG.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 1 '06 #2
Bob
Hi Randy,

Thanks for the quick response, trusty old outlook express went tits up
hence the double post :o)

I've tried the window.frames['IFrameName'].reload() but I'm getting a
javscript error of "object doesn't support this property or method".
I've enclosed a snippet of the code, could you be a star and point out the
error please :o)
======CODE======
<script language="JavaScript">
function refreshIt() {
window.frames['div2'].reload();
setTimeout('refreshIt()',5000); // refresh every 5 secs
}
</script>

<body onLoad="setTimeout('refreshIt()',5000);">
<iframe frameborder="0" scrolling="no" style="position: absolute; left:
0px; top: 00px;" id="div2" width="400" height="220"
src="CALLS.asp"></iframe>
</body>
======CODE======

Thanks in advance,
Rob

"Randy Webb" <Hi************@aol.com> wrote in message
news:5Y******************************@comcast.com. ..
Bob said the following on 5/1/2006 8:39 AM:
Hi All,

Is the following possible, and if so could someone show me some example
code
please :o)


Is it possible for you not to post the same question twice in under 120
seconds?
I have a web page with several iframes, and I want to be able to refresh
them only not the entire web page but also to refresh them at different
time
intervals. I've tried a few ways but it ends up refreshing the entire
page,
doh. I've tried with DIV's and objects aswell but no joy, I'm sure it
must
be possible and I'm been a thicket ;o)


window.frames['IFrameName'].reload()
Any ideas?


Yeah, lots of them. But most aren't fit for a family oriented NG.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/

May 1 '06 #3
Bob said the following on 5/1/2006 9:04 AM:
Hi Randy,

Thanks for the quick response, trusty old outlook express went tits up
hence the double post :o)
Did OE go tits up and make you top post as well?

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
I've tried the window.frames['IFrameName'].reload() but I'm getting a
javscript error of "object doesn't support this property or method".
I've enclosed a snippet of the code, could you be a star and point out the
error please :o)
======CODE======
<script language="JavaScript">
function refreshIt() {
window.frames['div2'].reload();
window.frames['div2'].href = 'CALLS.asp?'+(new Date().getTime());
//just set its .href property, which will cause it to
//reload. You will need to add a parameter to insure
//it gets loaded from the server and not the cache
//That is what the new Date().getTime() is for.
setTimeout('refreshIt()',5000); // refresh every 5 secs
}


var myInterval = window.setInterval('refreshIt',5000);
The entire script block would look like this:

<script type="text/javascript">
function refreshIt(){
window.frames['div2'].href = 'CALLS.asp?'+(new Date().getTime());
}
var myInterval = window.setInterval(refreshIt,5000);
window.onload = refreshIt;
</script>

Notes:

1) Do not use the language attribute, use type instead.
2) window.setInterval(param1,param2). param1 is not quoted if it is a
function reference, and the () is not added.
3) You could do this without a named function. (I will leave that for
you to search/research before I tell you how if you want to know).

Using myInterval as above, you can stop the refresh by using
window.clearInterval(myInterval);

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 1 '06 #4
Randy Webb wrote:
<snip>
window.frames['div2'].href = 'CALLS.asp?'+(new Date().getTime());

<snip>

It might be an idea to make that:-

window.frames['div2'].location.href = ...

- or some other variant that includes the - location - object.

Richard.
May 1 '06 #5
Richard Cornford said the following on 5/1/2006 3:45 PM:
Randy Webb wrote:
<snip>
window.frames['div2'].href = 'CALLS.asp?'+(new Date().getTime());

<snip>

It might be an idea to make that:-

window.frames['div2'].location.href = ...

- or some other variant that includes the - location - object.


When I first read your reply, my first thought was "Of course. Randy,
you are a dipstick". But I went back to my test file and re-tested it to
confirm that I did indeed check/test that code (and I did). And then I
started thinking about it and wondering - what browser does the code I
posted not work in? Latest release of that browser though.

I won't get into a "The specs say you should do this" discussion, but I
am curious where it doesn't work.

The only thing I changed in the code was adding a div to dump the href
into and kept posting it:

And then re-tested it in O7/8/9 (even though I specified the most recent
release of a browser), IE6, Firefox, Mozilla, they all worked fine.

<URL: http://members.aol.com/_ht_a/hikksnotathome/test/IFrameTest.html>

But yes, for historical and semantical reasons it should reference the
location object.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 1 '06 #6
Randy Webb wrote:
Richard Cornford said the following on 5/1/2006 3:45 PM:
Randy Webb wrote:
<snip>
window.frames['div2'].href = 'CALLS.asp?'+(new Date().getTime());
<snip>
It might be an idea to make that:-

window.frames['div2'].location.href = ...

- or some other variant that includes the - location - object.


When I first read your reply, my first thought was "Of course.
Randy, you are a dipstick".


Give it time ;-)
But I went back to my test file and re-tested it to confirm
that I did indeed check/test that code (and I did). And then
I started thinking about it and wondering - what browser does
the code I posted not work in? Latest release of that browser
though.
Well there you have to decide what constitutes 'work' in this case. My
impression was that the intended outcome included the re-loading of the
contents of the IFRAME. In which case I would expect that if I selected
the text shown in the IFRAME the selection would disappear when the
frame re-loaded. I would also expect that if, while your test page was
running in a browser, I disconnected from the internet the next re-load
would show some sort of "unable to connect to server" report. Neither of
these expectations was satisfied by IE 6 or Mozilla 1.7.
I won't get into a "The specs say you should do this"
discussion,
That would be a rather futile discussion in connection to the -
location - object as it has never been subject to formal specification.
but I am curious where it doesn't work.

The only thing I changed in the code was adding a div to
dump the href into and kept posting it:

And then re-tested it in O7/8/9 (even though I specified
the most recent release of a browser), IE6, Firefox, Mozilla,
they all worked fine.

<URL:
http://members.aol.com/_ht_a/hikksnotathome/test/IFrameTest.html>
Your code initially creates, and then re-assigns values to, an - href -
property of a window object, it then reflects these values into the DIV.
All of this 'works', and can be expected to work in pretty much any
scriptable browser. What I would not expect is any re-loading of the
content of the window object to which the - href - property was added as
a side effect of the assignments, and I found no evidence that any
re-loading of the IFRAME was happening.
But yes, for historical and semantical reasons it should
reference the location object.


Effectiveness is probably an overriding reason for including the -
location - object in the operation.

Richard.
May 1 '06 #7

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

Similar topics

0
by: Conax | last post by:
Hi, It's me again asking about IFRAME. With UncleWobby, Steven Burn and Roland Hall's help, I was able to create a proper IFRAME section on my page. Now I come to the next problem. I'd...
11
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
2
by: J-T | last post by:
Hello, I have an iframe which its scr is set to show a url (am image) .I am put this iframe on a user control and I am loading that user control dynamically to my Default.aspx.Now I need to...
0
by: Abhishek Srivastava | last post by:
Hello Everyone, I have two files. File 1 is called HTMLPage.html. The content of this file is <html><head><meta http-equiv='refresh' content='1'...
0
by: spolsky | last post by:
hi, i have the following pages. when form submitted with the field1 value is "ok" then the iframe must be loaded with the text "Page loaded...". This works fine with IE 6 and FireFox(1.5) but...
1
by: spolsky | last post by:
hi, i have the following pages. when form submitted with the field1 value is "ok" then the iframe must be loaded with the text "Page loaded...". This works fine with IE 6 and FireFox(1.5) but...
2
by: ericisjusteric | last post by:
I have a page with multiple iframes and need to have the user (ie6) be able to click a button to refresh any one of the iframes - but also to click another button at the top of the page to refresh...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.