As shown below:
Copy the code code as follows:
<HTML xmlns:CAP>
<HEAD>
<TITLE>JS detects whether user is online</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 welcomes you!";
}
else
{
sType.innerText="Why aren't you online?";
}
</script>
</HEAD>
<BODY>
<CAP:clientCaps id="oClientCaps" />
<div id=sType></div>
</BODY>
</HTML>