function Minutes(data) { alert(data.length); for (var i = 0; i < data.length; i++) if (data.substring(i, i + 1) == ":") break; return (data.substring(0, i)); } function Seconds(data) { for (var i = 0; i < data.length; i++) if (data.substring(i, i + 1) == ":") break; return (data.substring(i + 1, data.length)); } function Display(min, sec) { var disp; if (min <= 9) disp = " 0"; else disp = " "; disp += min + ":"; if (sec <= 9) disp += "0" + sec; else disp += sec; return (disp); } function Down() { sec--; if (sec == -1) { sec = 59; min--; } window.status = "Your session will time out in: " + Display(min, sec); if (min == 0 && sec == 0) { window.status = "Your session has timed out." alert("Your session has timed out."); }else { down = setTimeout("Down()", 1000); } } function timeIt() { var setTime = "00:10"; min = 1 * Minutes(setTime); sec = 0 + Seconds(setTime); Down(); } 在IE状态栏(左下角)显示会话超时信息.引用的时候只要在onload方法加入: timeIt()即可.