dynamically changing the refresh interval

M

marik

Hi, people.

I have a question:

Can somebody link me to a simple javascript piece of code, that allows
me to get input from a combo box and set the refresh interval of the
page to be that number?

Thank you,
marik
 
E

Evertjan.

marik wrote on 11 sep 2006 in comp.lang.javascript:
Can somebody link me to a simple javascript piece of code, that allows
me to get input from a combo box and set the refresh interval of the
page to be that number?

No, because it is not simple,
as you also have to send the value to the refreshed page.

And why link?
It can be written perfectly on "demand".
 
M

marik

So can you please show me how can it be done ( lets say I have page
A.html in which the combo box is, and I have page B.html that I want to
refresh every interval, that I put through the combo box)?
 
M

McKirahan

marik said:
So can you please show me how can it be done ( lets say I have page
A.html in which the combo box is, and I have page B.html that I want to
refresh every interval, that I put through the combo box)?

Will this work for you? Watch for word-wrap.

<html>
<head>
<title>refresh.htm</title>
<script type="text/javascript">
var sec;
var url = "http://www.google.com/index.html";
function pick() {
sec = document.getElementById("opt").value;
if (sec != "") show();
}
function show() {
window.open(url,"win","");
setTimeout("show()",sec*1000);
}
</script>
</head>
<body>
<form>
<b>Refresh Google every:</b>
<br>
<select id="opt" onchange="pick()">
<option value="">
<option value="5">5 seconds
<option value="30">30 seconds
<option value="60">60 seconds
</select>
</form>
</body>
</html>

This will work as long as "refresh.htm" is running.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top