利用JS判断用户是否上网(连接网络)
内容摘要
如下所示:复制代码 代码如下:<HTML xmlns:CAP><HEAD><TITLE>JS检测用户是否上网</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb2312"><style> @med
文章正文
如下所示:
<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>
代码注释