未经验证,收藏,防丢失
网站正常...... |
document.writeln('
');//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 = '网络存在问题,请检查您的网络连接后刷新页面。
如果还不能正常显示,请通知xxxxxxxxxx
';
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 = '';
window.setTimeout("playSWFGoal()", 10000);
}
catch(e){}
}
将以上两个文件上传到网站
以这样的网址打开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