87,924
社区成员
发帖
与我相关
我的任务
分享
<img src="http://i1.sinaimg.cn/home/deco/2009/0330/logo_home.gif" onload="alert('能上')" onerror="alert('不能上');" />
<img src="http://i1.sinaimg.cn/home/deco/2009/0330/logo_home.gif" onload="alert('能上')" onerror="alert("不能上");" />
<script>//连接状态
<%--start连接状态--%>
var xmlHttplink;
function createXMLLinkHttpRequest() {
if (window.ActiveXObject) {
xmlHttplink = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttplink = new XMLHttpRequest();
}
}
function doRequest() {
createXMLLinkHttpRequest();
xmlHttplink.onreadystatechange = handleChange;
xmlHttplink.open("HEAD", "../../login.do?method=linkStatus&date=" + new Date().getTime(), true);
xmlHttplink.send(null);
}
function handleChange() {
if(xmlHttplink.readyState == 4) {
if(xmlHttplink.status == 200){
document.getElementById("netlink").value="连接";
}else{
document.getElementById("netlink").value="断开";
alert("连接断开");
}
setTimeout("doRequest()", 1000);
}
}
</script>
<body onload="doRequest();" >
//网络连接状态
public ActionForward linkStatus(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response){
return mapping.findForward("top");//直接跳回原页面就好
}