日期:2014-05-16  浏览次数:20421 次

自动刷新的问题
test.html在ie里可实现定制刷新及自动刷新功能,但在fifefox中无法实现相应功能,各位多谢了。


代码如下:
test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function get_time_value()
{
  var time_interval=document.getElementById("newTime").value;
  var flag=null;

  if(time_interval.length == 0)//若不输入时间,默认3秒刷新一次
{
return 3000;
}
  else if(time_interval.length > 0 && time_interval.length < 5 && onlyNum(time_interval) )//设置刷新时间 
  {  
 
return time_interval*1000;  
  } 
  else
{
alert("输入有误,请重新输入");
window.location.reload();
}
}

function onlyNum(ss)
{
var type="^[0-9]*[1-9][0-9]*$"; 
var re = new RegExp(type); 
if(ss.match(re)==null) 
  {  
  return false;
  }
return true;
}

function do_refresh()
{
var chk_box=document.getElementsByName('checkbox1');
if(chk_box[0].checked == true)
{
//parent.window.location.reload();
//setTimeout("parent.window.location.reload()",get_time_value());
try{
//document.execCommand('Refresh',false,0);  
setTimeout("document.execCommand('Refresh',false,0)",get_time_value());
}catch (BorwerSupportException){  
window.location.reload();
}  
}
else
{
setTimeout('do_refresh()',10);
}
}



setTimeout('do_refresh()',10);
</script>
<title>Insert title here</title>
</head>

<body>
<h1>
AJSROOT
</h1>
<input type="checkbox" name="checkbox1" value="checkbox">自动刷新
<input id="newTime" type="text" size="4">设置刷新间隔(单位:秒)
<br>
<img src=./show.png> 
<ul>
<!--
<li><a target=_blank href="./JobnetView.jsp?id=1408">Test</a></li><li><a target=_blank href="./JobnetView.jsp?id=1415">aa</a></li><li><a target=_blank href="./JobnetView.jsp?id=1423">checklog1</a></li><li><a target=_blank href="./JobnetView.jsp?id=1425">checklog_exe</a></li><li><a target=_blank href="./JobnetView.jsp?id=1426">demo</a></li><li><a target=_blank href="./JobnetView.jsp?id=1432">demo-bak</a></li><li><a target=_blank href="./JobnetView.jsp?id=1783">icon</a></li><li><a target=_blank href="./JobnetView.jsp?id=1807">test2</a></li>
-->
</ul>
<!-- <img src=./show?id=910> -->
<table width="800" border="1">
  <tr bgcolor="#CCCCCC">
  <td width="113" align="center">作业网名</td>
  <td width="160" align="center">JP1用户</td>
  <td width="153" align="center">JP1资源组</td>
  <td width="253" align="center">开始时间</td>
  <td width="253" align="center">结束时间</td>
  <td width="146" align="center">注释</t