J
jbas
Unregistered / Unconfirmed
GUEST, unregistred user!
各位好,我现在有一javascript,是判断是否在线的,可是当我在在线状态下用时,没有问题,在离线状态下也没有问题,可是如果在在线状态下,又离线,IE就会死掉,请帮忙了!
<script language="JavaScript">
var x,s,stat;
var http = new ActiveXObject("Microsoft.XMLHTTP");
function ISConn(url) {
http.onreadystatechange=managestatechange;
http.Open("GET",url,false);
try{
http.send();
}
catch(e){
return 0;
}
return 1;
}
function managestatechange() {
switch (http.readyState) {
case 2, 3:
return 0;
break;
case 4:
return 1;
break;
}
}
function check(){
s=ISConn("http://www.163.com");
if (s==0){
clearInterval(x);
return 0;
}
else
{
return 1;
}
}
functiondo
action(){
stat=check();
if (stat==1) {
alert('lined');
}else
{
alert('can not line the srever');
}
}
x=setInterval("doaction()",5000)
</script>
<script language="JavaScript">
var x,s,stat;
var http = new ActiveXObject("Microsoft.XMLHTTP");
function ISConn(url) {
http.onreadystatechange=managestatechange;
http.Open("GET",url,false);
try{
http.send();
}
catch(e){
return 0;
}
return 1;
}
function managestatechange() {
switch (http.readyState) {
case 2, 3:
return 0;
break;
case 4:
return 1;
break;
}
}
function check(){
s=ISConn("http://www.163.com");
if (s==0){
clearInterval(x);
return 0;
}
else
{
return 1;
}
}
functiondo
action(){
stat=check();
if (stat==1) {
alert('lined');
}else
{
alert('can not line the srever');
}
}
x=setInterval("doaction()",5000)
</script>