<!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=gb2312" />
<script type="text/javascript" src="website.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<title>无标题文档</title>
</head>
<body>
<script language="Javascript" >
//创建xmlHttp对象
var xmlHttp = null;
function createXMLRequest( ){
var msxmlhttp = new Array(
'Msxml2.XMLHTTP.6.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for(var i = 0; i < msxmlhttp .length; i++) {
try {
if(xmlHttp = new ActiveXObject(msxmlhttp[i] )) break;
} catch (e) {
xmlHttp = null;
}
}
if(!xmlHttp && typeof XMLHttpRequest != "undefined")
xmlHttp = new XMLHttpRequest();
}
var isDown = "";
function getHtml(webState){
createXMLRequest( );
//状态调用函数
xmlHttp.onreadystatechange = function(){
if ( xmlHttp.readyState == 4 ){
alert(xmlHttp.status);
if (xmlHttp.status != 200){
isDown = "noOk";
}else{
isDown = "ok";
}
}
}
//发送请求
xmlHttp.open( "get",webState,false); //此处false为发送同步请求,如果为true则为异步,这样会造成isDown返回为“”
xmlHttp.send( null );
return isDown;
}
$(function(){
var stations=eval(stationList);
for(var i=0;i<stations.length;i++){
alert(getHtml(stations[i].url));
isDown = "";
}
});
</script>
</body>
</html>
2:website.js代码
var stationList=[
{"station":"亚太家居网","url":"www.asia-home.com.cn/asiasys/index.jsp","administrator":"test,test"},
{"station":"软装集群(后台,布艺,墙纸,地毯)","url":"cms.asia-home.com.cn","administrator":"test,test"},
{"station":"广告系统","url":"ad.asia-home.com.cn","administrator":test,test"},
{"station":"rss系统","url":"rss.asia-home.com.cn","administrator":"test,test"},
]
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="website.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<title>无标题文档</title>
</head>
<body>
<script language="Javascript" >
//创建xmlHttp对象
var xmlHttp = null;
function createXMLRequest( ){
var msxmlhttp = new Array(
'Msxml2.XMLHTTP.6.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for(var i = 0; i < msxmlhttp .length; i++) {
try {
if(xmlHttp = new ActiveXObject(msxmlhttp[i] )) break;
} catch (e) {
xmlHttp = null;
}
}
if(!xmlHttp && typeof XMLHttpRequest != "undefined")
xmlHttp = new XMLHttpRequest();
}
var isDown = "";
function getHtml(webState){
createXMLRequest( );
//状态调用函数
xmlHttp.onreadystatechange = function(){
if ( xmlHttp.readyState == 4 ){
alert(xmlHttp.status);
if (xmlHttp.status != 200){
isDown = "noOk";
}else{
isDown = "ok";
}
}
}
//发送请求
xmlHttp.open( "get",webState,false); //此处false为发送同步请求,如果为true则为异步,这样会造成isDown返回为“”
xmlHttp.send( null );
return isDown;
}
$(function(){
var stations=eval(stationList);
for(var i=0;i<stations.length;i++){
alert(getHtml(stations[i].url));
isDown = "";
}
});
</script>
</body>
</html>
2:website.js代码
var stationList=[
{"station":"亚太家居网","url":"www.asia-home.com.cn/asiasys/index.jsp","administrator":"test,test"},
{"station":"软装集群(后台,布艺,墙纸,地毯)","url":"cms.asia-home.com.cn","administrator":"test,test"},
{"station":"广告系统","url":"ad.asia-home.com.cn","administrator":test,test"},
{"station":"rss系统","url":"rss.asia-home.com.cn","administrator":"test,test"},
]