1. 
<%
  if hasnewcontent then
    response.write "<bgsound src='yoursoundfile'>"
  end if
%>2. 
<script language="javascript">
function quit()
{
event.returnValue="关闭此窗口你将不能及时知道你的状态和收到的信息,确定要关闭吗?";
}
</script>
<body onbeforeunload="quit()" ... > 

解决方案 »

  1.   

    try this:<html>
    <head>
    <script language="javascript">
    var timerID = null;
    var bRefresh = false;
    function quit()
    {
       if (!bRefresh)
    event.returnValue="Are you sure you want to close?";
       
      // if (timerID)
    //clearTimeout(timerID);
    }function refresh()
    {
       bRefresh = true;
       location.reload(true);
    }timerID = setTimeout("refresh()",30000,"Javascript");
    </script>
    </head>
    <body onbeforeunload="quit();">
    <script language="javascript">
    var dt= new Date();
    document.write(dt);
    </script>
    </body>
    </html>
      

  2.   

    这个timeid有什么用啊?看不太明白
      

  3.   

    是在setTimeout后设置的,你可以用它来消除timer,但在这里没用,你可以去掉它