[查看演示] 源码如下 ---------------------------------------------------------- <html xmlns:ie>
<head>
<title>是否在线.-www.51windows.Net</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="51windows,海娃,haiwa">
<META NAME="Description" CONTENT="Power by 51windows.Net">
<style>
<!--
@media all {
IE\:CLIENTCAPS {behavior:url(#default#clientCaps)}
}
*{font:menu}
-->
</style>
</head>
<body>
正在上网时,把网卡禁用后,大约四秒中检测出离线!!,启用网卡后8秒左右检测出在线!!!
<IE:CLIENTCAPS ID="oClientCaps" />
<script Language="javascript">
function onlineOrNot()
{
onlinestate = (oClientCaps.connectionType == "offline")?"<font color=red>离线</font>":"<font color=green>在线</font>"
statehtml.innerHTML += onlinestate+","
}
setInterval("onlineOrNot()",1000)
</script>
<div id=statehtml></div>
</body>
</html>
<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="Button" value="查看源代码" onClick= 'window.location = "view-source:" + window.location.href'></div> |