利用JS判断用户是否上网(连接网络)
人气:0
如下所示:
<HTML xmlns:CAP>
<HEAD>
<TITLE>JS检测用户是否上网</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb2312">
<style>
@media all {CAP\\:clientCaps {behavior:url(#default#clientcaps)}}
</style>
<script for=window event=onload>
if (oClientCaps.connectionType=="online")
{
sType.innerText="Internet欢迎您!";
}
else
{
sType.innerText="怎么没有上网?";
}
</script>
</HEAD>
<BODY>
<CAP:clientCaps id="oClientCaps" />
<div id=sType></div>
</BODY>
</HTML>
复制代码 代码如下:
<HTML xmlns:CAP>
<HEAD>
<TITLE>JS检测用户是否上网</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb2312">
<style>
@media all {CAP\\:clientCaps {behavior:url(#default#clientcaps)}}
</style>
<script for=window event=onload>
if (oClientCaps.connectionType=="online")
{
sType.innerText="Internet欢迎您!";
}
else
{
sType.innerText="怎么没有上网?";
}
</script>
</HEAD>
<BODY>
<CAP:clientCaps id="oClientCaps" />
<div id=sType></div>
</BODY>
</HTML>
加载全部内容