用一个frame隔段时间访问数据库中检查新消息,有新消息就window.open一个消息页面,点击已阅把数据库中记录改为已读,再关闭该窗口。
解决方案 »
- [模式匹配]文件操作
- php 文件名、目录名或卷标语法不正确
- UFT8能不能通过字符的第一个字节判断这个字符是不是中文
- 高分紧急求救,php5+IIs5.1+MYSQL4.0配置问题,搜遍了互联网问题解决不了。。。
- 请教怎样安装php+mysql在win2000下,具体怎配置呢?
- 大家好啊,问一下,怎么用php实现。。。。。。
- 很奇怪的一个sql结果.
- 入门问题
- 如何截取左边或右边的一串字符?
- 急!!!我有个php程序要请调试,给200分。请赐教!!!
- 谁知道那儿有PHP下载?
- 能不能在insert完数据后返回auto_increment字段的值?如果insert语句没有这个功能还有比较高效的办法吗?
5555,
<script>
function close(){
settimeout(5000,close_2());
}
funciont close_2(){
window.close();
}
</script>
函数我不见得写的是对的,但是意思你应该明白,
用脚本控制时间在5秒,
global $login_status;
if($login_status==1){
echo<<<EOD
<Iframe src="showmessage.php" id="test" width="0" height="0" scrolling="no" align=top frameborder="0">< /iframe >
EOD;
}
}然后在首页调用checkmessage()
<META HTTP-EQUIV="Refresh" CONTENT="20">
<script language=JavaScript1.2>
function Show(divid) {
divid.filters.revealTrans.apply();
divid.style.visibility = "visible";
divid.filters.revealTrans.play();
}
messageimg="<img src=images/newmail.gif width=145 height=11>";
</script>
<?
include("config.php");//连接数据库
include("global.php");//函数
if($login_status==1){
$sql = "SELECT count(id) FROM message where incept='$articleusername' and flag=1";
$result=$userdb->Execute($sql);
$totalMessage=$result->fields[0];
$sql = "SELECT count(id) FROM message where incept='$articleusername' and flag=0";
$result=$userdb->Execute($sql);
$totalNewMessage=$result->fields[0];
echo<<<EOD
<script language=JavaScript1.2>
Messageinfo="你有<font color=#FF0000> $totalMessage </font>条旧消息和<font color=#FF0000> $totalNewMessage </font>条新消息";
parent.checkmessage.innerHTML=Messageinfo;
parent.newmessage.innerText="$totalNewMessage";
</script>
EOD; if(!$result->EOF and $totalNewMessage>=1){
echo<<<EOD
<script language=JavaScript1.2>
parent.checkmessage.innerHTML+=messageimg;
Show(parent.messanger);
</script>
EOD;
}}里面有些函数没有给出,意思你可以看明白的