定义数据库字段一个标志,用来标记是否已经读取
在客户端定时刷新,检索数据库,判断当前用户是否存在有未度过的消息。
如果有则提示。就像csdn一样

解决方案 »

  1.   

    短信那一条是一个框架,这个框架中的页面是1000秒自动刷新一次:
    <meta http-equiv="Refresh" content="1000;URL=/expert/deeptree/contentbar.asp?myie=ie">
    看看这个框架里面的源文件,每过一定时间刷新一次,用脚本控制图片的显示
    -------------------
    <html>
    <head>
    <meta http-equiv="Refresh" content="1000;URL=/expert/deeptree/contentbar.asp?myie=ie">
    <META NAME="Robots" CONTENT="noindex">
    <meta content="text/html;charset=gb2312" http-equiv="Content-Type">
    <meta name="MSSmartTagsPreventParsing" content="TRUE">
    <meta http-equiv="MSThemeCompatible" content="Yes"><TITLE>Deeptree Content Bar</TITLE>
    <LINK REL="stylesheet" TYPE="text/css" HREF="/csdn.css">
    <script src="/Expert/style/get_css.js"></script>
    </head>
    <script language="javascript">
      if (top.location == self.location)
        {
        top.location.href = "/Expert/Forum.asp";
        } function selectstart()
       {
       window.event.cancelBubble = true;
       window.event.returnValue = false;
       return false;
       }
    function GoToURL(strX)
    {
    if (strX == "" || strX == null || strX == "undefined")
    {
    return;
    }
    window.top.location.href = strX;
    }
    function mylogin(url)
    {
    window.parent.parent.location = url+"&from="+window.parent.parent.location.pathname+"&Roomid=&typenum=&tabletype=&searchKeys=&author=&whichpage=";
    }
    function mylogin2(url)
    {
    window.open(url+"&from="+window.parent.parent.location.pathname);
    newMessage.style.visibility = "hidden";
    }
    function loginsub()
    {
    document.login.submit();
    }
    //-->
    </SCRIPT>
    <body  topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" class="color3">
    <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
      <tr>
        <td align="left" VALIGN="top" width="100%" NOWRAP>
        
        <div id="showtoc" name="showtoc" style="display:none;">
        
        <table onclick="top.dtbar.showtoc();" align="left" border=0 cellpadding=0 cellspacing=0 title="显示菜单" style="cursor:hand">
          <tr>
            <td height="30"></td>
            <td height="30" valign="middle"><img title="显示菜单" border="0" src="/expert/deeptree/images/showtoc.gif" /></td>
            <td height="30"></td>
            <td height="30" valign="middle"><a href="#"><font face="verdana" color="#FFFFFF">显示菜单</font></a></td>
          </tr>
        </table>
        </div>
    <table border="0" width="100%">
    <form method="post" action="/member/logon.asp" target="_top" name="login">
    <script>
    document.write("<input type='hidden' name='from' value='")
    document.write(parent.parent.location)
    document.write("'>")
    </script>
    <tr><td valign="top">
    <font color="#ffffff"> <img src="/images/1d.GIF" width="19" height="15">欢迎您:acewang 
    <img src="/images/1d.GIF" width="19" height="15">可用分:3510
    <img src="/images/1d.GIF" width="19" height="15">总信誉分:100
    <img src="/images/1d.GIF" width="19" height="15"><a href="/member/logonout.asp" target="_top"><font color="#ffffff">注销我的登录</font></a>
    </td><td>

    <div id="newMessage" name="newMessage" style="visibility:visible">
    <a href="/Message_Board/NewMessage.asp?typestate=0" onClick="javascript:newMessage.style.visibility = 'hidden';" target="_blank" class="Func"><font color="#ffffff">你有短消息</font><img src="/Expert/images/mail.GIF" width="26" height="16" align="absmiddle" border="0"></a><br/>
    </div>
    <bgsound src="/Expert/Deeptree/newMessage.wav" border="0">

    </font>
    </td></tr></form></table></td></tr></table>
    </body>
    </html>
      

  2.   

    seehttp://expert.csdn.net/Expert/topic/2260/2260089.xml?temp=.1410639
      

  3.   

    Try
                uName = Server.UrlDecode(Request.Cookies.Item("wuyinMember")("userName"))
            Catch ex As Exception        End Try
            Dim myreader As SqlClient.SqlDataReader = _mydb.ExecuteReader("select userid from [user] where userName=@p0", incept.Value.Trim)        If ((myreader.HasRows)) Then
                myreader.Close()
                _mydb.ExecuteNonQuery("insert into message (incept,sender,title,content,sendtime,flag,issend) values (@p0,@p1,@p2,@p3,GetDate(),0,1)", incept.Value.Trim, uName, title.Value.Trim, content.Value.Trim)
                MsgPanel.Visible = False
                Call WuyinWeb.CommonClass.DispInfo("<b>恭喜您,您的短消息已经成功发送到" & incept.Value & "信箱中!</b><br /><hr size=1 height=1 noshade width=100% />您可以:<br /><li><a class=px12 href=" & Request.ServerVariables("HTTP_REFERER") & ">返回上一页</a><li><a class=px12 href=../ >回到论坛首页</a><li><a class=px12 href=/ >返回首页</a>", msg)
            Else
                MsgPanel.Visible = False
                Call WuyinWeb.CommonClass.DispInfo("<b>本论坛好像没有<font color=""red"">" & incept.Value & "</font>这个会员呀!~请检查一下吧!</b><br /><hr size=1 height=1 noshade width=100% />您可以:<br /><li><a class=px12 href=" & Request.ServerVariables("HTTP_REFERER") & ">返回上一页</a><li><a class=px12 href=../ >回到论坛首页</a><li><a class=px12 href=/ >返回首页</a>", msg)
            End If
        End Sub