tvu
02-13-2003, 10:05 PM
I'm trying to allow the user to enable/disable auto refresh and set the refresh interval on the current page, but it doesn't seem to work. Here's the relevant code extracted from the JSP page.
Any help would be appreciated.
<html>
<head>
<!-- placeholder for meta tag-->
<meta id="autoRefresh"/>
<title>Auto Refresh</title>
<script language="javascript">
function handler() {
//verify that auto refresh is selected
var auto = document.getElementById("auto");
if (auto.checked) {
//extract the refresh interval
var i = document.forms[0].interval.selectedIndex;
var v = document.forms[0].interval.options[i].value;
//set auto refresh and interval
var meta = document.getElementById("autoRefresh");
meta.setAttribute("http-equiv", "Refresh");
var content = v + ";url=javacript:document.forms[0].submit()";
meta.setAttribute("content", content);
}
}
</script>
</head>
<body>
<form name="Test" method="post" action="Controller">
Auto Refresh <input id="auto" type="checkbox" onClick="handler()"/>
Update interval (in seconds):
<select name="interval" id="interval">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
</form>
</html>
Any help would be appreciated.
<html>
<head>
<!-- placeholder for meta tag-->
<meta id="autoRefresh"/>
<title>Auto Refresh</title>
<script language="javascript">
function handler() {
//verify that auto refresh is selected
var auto = document.getElementById("auto");
if (auto.checked) {
//extract the refresh interval
var i = document.forms[0].interval.selectedIndex;
var v = document.forms[0].interval.options[i].value;
//set auto refresh and interval
var meta = document.getElementById("autoRefresh");
meta.setAttribute("http-equiv", "Refresh");
var content = v + ";url=javacript:document.forms[0].submit()";
meta.setAttribute("content", content);
}
}
</script>
</head>
<body>
<form name="Test" method="post" action="Controller">
Auto Refresh <input id="auto" type="checkbox" onClick="handler()"/>
Update interval (in seconds):
<select name="interval" id="interval">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
</select>
</form>
</html>