我的页面要不定时刷新,我的页面上有一个下拉列表中有些数字,在程序运行的时候选择下拉列表的中的数字,比如说选中5,那么页面就5秒中刷新一次,选择8就8秒钟刷新一次,
请问如果做到,谢谢各位,
如果是定时我知道怎么做,<meta http-equiv="refresh" content="4" />这样就每4秒钟刷新一次,
但是不定时,要根据选择的数字来决定多少时间刷新一次的话我就不会了,谢谢各大大侠,请给我指点哈,谢谢!
请问如果做到,谢谢各位,
如果是定时我知道怎么做,<meta http-equiv="refresh" content="4" />这样就每4秒钟刷新一次,
但是不定时,要根据选择的数字来决定多少时间刷新一次的话我就不会了,谢谢各大大侠,请给我指点哈,谢谢!
试试看 前提是如果你是做.NET开发的!
然后将读出~~
{
var spanTime=document.getElementById("下拉列表框的值").value;
window.location.reload(true);
window.setTimeOut("reFreshWind",sPanTime*1000);
}
window.setTimeOut("reFreshWind",1000);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
function reFreshWind()
{
var selectedIndex = document.getElementById("refresh").selectedIndex;
var spanTime = document.getElementById("refresh").options[selectedIndex].value;
window.location.reload(true);
window.setTimeout(reFreshWind,Number(sPanTime)*1000);
}
var refrsh=function() {window.setTimeout(reFreshWind,1000); }
</script></head><body>
<select id="refresh" onchange="refrsh()" >
<option value="1" >1分钟</option>
<option value="2" >2分钟</option>
<option value="5" >5分钟</option></select>
</body>
</html>