未经验证,收藏,防丢失
<!--1 test.htm文件开始-->
<html>
<head>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<title>网站测试页面</title>
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><span id="ts">网站正常......</span><br><span id="sj"></span></td>
</tr>
</table>
<SCRIPT language=javascript>
document.writeln('<div style="position:absolute;top:-100;left:-100;" id="LiveGoalMusic" name="LiveGoalMusic"></div>');
var xmlDocTopic = null;
//Possible prefixes ActiveX strings for DOM DOcument
var ARR_ACTIVEX = ["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XmlDom"];
//When the proper prefix is found, store it here
var STR_ACTIVEX = "";
var bXMLCtlFound = false;
for(var i=0; i < ARR_ACTIVEX.length && !bXMLCtlFound; i++){
try{
xmlDocTopic = new ActiveXObject(ARR_ACTIVEX[i]);
STR_ACTIVEX = ARR_ACTIVEX[i];
bXMLCtlFound = true;
}
catch(objException){
xmlDocTopic = null;
}
}
if (!bXMLCtlFound){
throw "No DOM DOcument found on your computer.";
}
var oldUpdateTime = "";
var lastUpdateTime;
var checktime=60000;//超时时间,单位:毫秒
var refuTime=30000;//刷新页面时间,单位:毫秒
my1=OpenXML();
my2=check();
sj.innerHTML = new Date();
function OpenXML(){
xmlDocTopic.load("time.xml");
xmlDocTopic.onreadystatechange = xmlDocTopiconreadystatechange;
my1=window.setTimeout("OpenXML()", refuTime);
}
function check(){
if (oldUpdateTime == lastUpdateTime && oldUpdateTime != ""){
if(my1 != null) clearTimeout(my1);
if(my2 != null) clearTimeout(my2);
ts.innerHTML = '网络存在问题,请检查您的网络连接后刷新页面。<br>如果还不能正常显示,请通知xxxxxxxxxx<br><input type="submit" name="Submit" value="刷新" οnclick="location.reload(true);">';
playSWFGoal();
// if (confirm("由于网络问题,你已经和服务器断开连接超过 "+(checktime/1000/60)+" 分钟,是否要重新连接?/n/n 如果得新连接后无法查看页面请通知管理员:xxxxxxxxxxxxx"))
// {
// location.reload(true);
// }
}
oldUpdateTime = lastUpdateTime;
my2=window.setTimeout("check()", checktime);
}
function xmlDocTopiconreadystatechange(){
if (xmlDocTopic.readyState != 4) return;
if (xmlDocTopic.xml == "")return;
// alert(xmlDocTopic.readyState);
d = new Date();
lastUpdateTime = FormatNumber(d.getHours()) + ":" + FormatNumber(d.getMinutes());
sj.innerHTML = d;
}
function FormatNumber(n){
if (n < 10)
return ("0" + n);
else
return n;
}
function playSWFGoal(){
try{
LiveGoalMusic.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="0" height="0"><param name="movie" value="http://www.gooooal.com/live/goal.swf"><param name="quality" value="high"><param name="wmode" value="transparent"></object>';
window.setTimeout("playSWFGoal()", 10000);
}
catch(e){}
}
</script>
</body>
</html>
<!--1 test.htm文件结束-->
<!--2 time.xml文件开始-->
<?xml version='1.0' encoding='GB2312'?>
<Data>
<M>
<G>36#1#2000</G>
</M>
</Data>
<!--2 time.xml文件结束-->
将以上两个文件上传到网站
以这样的网址打开http://www.xxx.xxx.xx/test.htm (www.xxx.xxx.xx为你的网址) 并且打开音箱(该例子以http://www.gooooal.com/live/goal.swf为报警声)
如果警报声响则说明网络正常但你要检测的网站不能访问,
如果提交出错但没警报声则说明你的网络链接有问题。
如需转载请声明出处:http://blog.csdn.net/stbrine/
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/stbrine/archive/2006/06/05/774255.aspx