AJAX-prototype 无法更新
本人测试Ajax.PeriodicalUpdater()进行定时更新,但是内容不跟新啊
求救.....
HTML代码如下
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>时间</title>
<script type="text/javascript" src="prototype.js">
</script>
<script language="javascript">
function update()
{
//var infos=$F("info");
new Ajax.PeriodicalUpdater("timeDisplay","date.jsp",{method:"get",frequency:2,parameters:{timestamp:new Date().getTime()}});
}
</script>
</head>
<body>
<input type="button" onclick="update()" value="Click me"/>
<span id="timeDisplay"></span>
<div id="information"></div>
</body>
</html>
jsp代码如下
<%@ page contentType="text/html;charset=gb2312"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<jsp:useBean id="now" class="java.util.Date"/>
<fmt:formatDate value="${now}" pattern="MMMM dd,yyyy hh:mm:ss aa"/>