我们在网页制作的过程中经常会遇到及时刷新数据的问题,如果使用 的方法,会造成整个屏幕不断闪烁刷新的效果,这会降低用户的操作满意度。
所以我们需要一种可以实现无闪自动刷新数据的方法来解决以上问题。
实例解决问题:
希望实现用户在进入系统以后(整个session的时效之内),如果收到新邮件则发出声音提示。
实现思路:
1.首页部分:< body
alt=新邮件 src=img/tp024.gif />
<embed src='music/nudge.wma' hidden=true autostart=true loop=false>";
checkresult=0;
}
}
}
// -->
3.check_mail.jsp
<%@ page contenttype="text/html; charset=gbk" %>
<%@ page errorpage="error/login_error.jsp"%>
<%@ page import="myweb.*" %>
<%@ page import="java.sql.*" %>
<%
string user=request.getparameter("uname");
connection conn=null;
try{
conn=dbconnection.getconnection();
preparedstatement pstat=conn.divparestatement("
select * from message where r_name='"+user+"' and status=0");
resultset rs=pstat.executequery();
if(rs.next()){//有记录
response.getwriter().print(0);
}else{
response.getwriter().print(1);
}
}finally{
if(conn!=null) conn.close();
}
%>
4.首页结果显示
将< span id="test1" > < /span >插入指定位置。
闽公网安备 35060202000074号