<% cfg_get("ddns_error"); %>
应该是<%=cfg_get("ddns_error")%>吧如果不行就别用self.location.reload();
用self.location=self.location一样可以自刷新
应该是<%=cfg_get("ddns_error")%>吧如果不行就别用self.location.reload();
用self.location=self.location一样可以自刷新
解决方案 »
- 召唤高手实现网页常见到的代码~~~~~~~~~~~~~~~~
- 为什么我用document.cookie无法保存cookie
- 关于微软的语音开发包SDK5.1网页版上传到自己的网站后不能正确使用的问题
- 关于带CheckBox的Tree的问题求教
- js截断指定字符串,整个页面
- 怎么从window获得该页面的javascript中变量呢
- 请教高手:vbscript改写为javascript
- 求js的封装问题,dataset
- 请问一个比较普通但我一点都不会的问题.谢谢各位先!
- action中通过ajax返回一个json类型的数据到JSP,并在JSP中解析出来
- JS移除表单指定行
- JS 怎样获取该标签的id ??
1000是等待或间隔时间
用这种方法试试.
<html>
<head>
<script language="javascript" type="text/javascript">
<!-- hide script from old browsers
function msg()
{
// var status = " <% cfg_get("ddns_error"); %>";
//confirm('test 002');
//document.write('hello world.');
return 1;
}
function show_message()
{
setTimeout("self.location.reload();",1000);
//var status = " <% cfg_get("ddns_error"); %>";
// confirm('test 001');
if(msg() == 1)
{
// setTimeout("self.location.reload();",1000);
//setTimeout("window.location.href='test.html'",5000);
alert('5 seconds!'); //用来测试是否刷新
}
}
//-->
</script>
</head>
<body onLoad="show_message();">
</body>
</html>
改成该段代码就能自动刷新了。原因:document.write()与 onLoad页面后有冲突的
<title>Refresh JavaScript Example</title>
<noscript>
<!--
We have the "refresh" meta-tag in case the user's browser does
not correctly support JavaScript or has JavaScript disabled. Notice that this is nested within a "noscript" block.
-->
<meta http-equiv="refresh" content="2"></noscript><script language="JavaScript">
<!--var sURL = unescape(window.location.pathname);
function refresh()
{
// This version of the refresh function will cause a new
// entry in the visitor's history. It is provided for
// those browsers that only support JavaScript 1.0.
//
window.location.href = sURL;
}
//-->
</script><script language="JavaScript1.1">
<!--
function refresh()
{
// This version does NOT cause an entry in the browser's
// page view history. Most browsers will always retrieve
// the document from the web-server whether it is already
// in the browsers page-cache or not.
//
window.location.replace( sURL );
}
//-->
</script><script language="JavaScript1.2">
<!--
function refresh()
{
// This version of the refresh function will be invoked
// for browsers that support JavaScript version 1.2
//
// The argument to the location.reload function determines
// if the browser should retrieve the document from the
// web-server. In our example all we need to do is cause
// the JavaScript block in the document body to be
// re-evaluated. If we needed to pull the document from
// the web-server again (such as where the document contents
// change dynamically) we would pass the argument as 'true'.
//
window.location.reload( false );
}
//-->
</script>
</head><!--
Use the "onload" event to start the refresh process.
-->
<body onLoad="doLoad()"><script language="JavaScript">
<!--
function doLoad()
{
// the timeout value should be the same as in the "refresh" meta-tag
setTimeout( "refresh()", 2*1000 );
}
// we put this here so we can see something change
document.write('<b>' + (new Date).toLocaleString() + '</b>');
//-->
</script>
</body></html>