<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ page contentType="text/html; charset=UTF-8"%> <html> <head> <title>标题</title> <% java.util.Map<String,Object> userInfo = (java.util.Map<String,Object>)session.getAttribute("userInfo"); %> <script language="javascript"> function RunOnBeforeUnload(){ //window.location='logout'; } function RunOnUnload(){ } function quit(){ window.location='logout'; } </script> </head> <body onbeforeunload="RunOnBeforeUnload()" onunload="RunOnUnload()"> <%=userInfo.get("username") %>您已登陆本系统 <input type="button" value="退出" onClick="quit()"/> </body> </html>