jsp ajax 延遲加載..
<html>
<script language="javascript">
function aaa(){
setTimeout("showComment('<%=request.getParameter("userid")%>')",5000) ; //延遲加載
}
function showVistor(){
document.getElementById("objID").innerHTML="加載完畢";
}
function showComment(userid){
var ajaxobj=new AJAX();
ajaxobj.method="GET";
ajaxobj.url="blogProcess.jsp?action=showComment&userid="+userid;
ajaxobj.callback=function(){
$F("commentcon",ajaxobj.gettext());
}
ajaxobj.send();
}
function $F(objID,html){
$(objID).innerHTML=html;
}
function $(objID) {
return document.getElementById(objID)
}
</script>
<body>
<div id="objID"> 加載中......<script>aaa()</script></div>
</body>
</html>
posted on 2008-12-15 10:43 小卓 閱讀(1299) 評論(0) 編輯 收藏 所屬分類: html and js