您的位置:首页 > 其它

Ajax之数据连接信息捕获

2016-04-06 10:01 302 查看
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<script language="javascript" src="JS/AjaxRequest.js"></script>
<script language="javascript">
/******************错误处理的方法*******************************/
function onerror(){
alert("您的操作有误!");
}
/******************实例化Ajax对象的方法*******************************/
function getInfo(){
var loader=new net.AjaxRequest("getInfo.jsp?nocache="+new Date().getTime(),deal_getInfo,onerror,"GET");
}
/************************回调函数**************************************/
function deal_getInfo(){
document.getElementById("showInfo").innerHTML=this.req.responseText;
}
window.onload=function(){
getInfo();    //调用getInfo()方法获取公告信息
window.setInterval("getInfo()", 1000);    //每隔1秒调用一次getInfo()方法
}
</script>

<title>实时显示公告信息</title>
</head>
<body>
<div style="border: 2px solid;height: 350px; width:350px;padding: 5px;color:#FF0000">
<marquee direction="up" scrollamount="3">
<div id="showInfo"></div>
</marquee>
</div>
</body>
</html>


index.jsp
run:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: