短消息的效果如何做? 用一个frame隔段时间访问数据库中检查新消息,有新消息就window.open一个消息页面,点击已阅把数据库中记录改为已读,再关闭该窗口。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 phpteam(George) :写段代码贴出来瞧瞧行不行? 好简单啊,5555,<script>function close(){settimeout(5000,close_2());}funciont close_2(){window.close();}</script>函数我不见得写的是对的,但是意思你应该明白,用脚本控制时间在5秒, function checkMessage(){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() showmessage.php代码如下:<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; }}里面有些函数没有给出,意思你可以看明白的 php程序如何安装外部打印软件 如何重写url,使得url出现文章的标题? apache 的ErrorDocument 500 为什么对php 页面没有生效果 天底下最牛的问题? 这个怎么做 在线哟!!!!php分页问题,多多指教!!! 关于参数传递的问题! 如何把汉字变为电子书库这样的编码? 新手上路,不幸堵车,望哪位大吓指明一条前进路! 如何写购物车类,高手请进! 谁知道那儿有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;
}}里面有些函数没有给出,意思你可以看明白的