Connecting Tech Pros Worldwide Forums | Help | Site Map

dynamic reload delay with http-equiv and javascript?

Troy
Guest
 
Posts: n/a
#1: Jul 20 '05
Hello-

I have a need to allow a user to reload a page on a chosen interval
(selected from a select box) or to chose not to reload the page at all
(default).

I would like to do this in javascript.

Currently I am using the meta tag as default, no refresh:

<META http-equiv="refresh" content="" url="" id="reloader">

Then I want the user to be able to dynamically select that using a select
box and javascript. The javascript looks like this:

<SCRIPT>
function setReloader(delay){
reloader.content=delay;
}
</SCRIPT>

And the select box looks like this:

<SELECT onchange="setReloader(this.options[this.selectedIndex].value)">
<OPTION value="">No refresh</OPTION>
<OPTION value="10">10 Seconds</OPTION>
<OPTION value="30">30 Seconds</OPTION>
</SELECT>

I can verify (using alert boxes) that the select works and sends the proper
value to the javascript function. However the JS function doesn't seem to
be able to modify the meta tag. Is this concept even possible? If not then
what are some alternative choices?

thanks.
troy






Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#2: Jul 20 '05

re: dynamic reload delay with http-equiv and javascript?


"steve stevo" <steve@stevosteve.fsnet.co.uk> writes:

Please don't top post.
[color=blue]
> function setReloader(delay){
>
> setTimeout(window.location.href=http://www.yahoo.com,delay*1000);
>
> }[/color]

You need som quotes for this to work:
setTimeout("window.location.href='http://www.yahoo.com'",delay*1000);

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Closed Thread