<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="分享简单的聊天室程序的php代码" id="card1">
<p> 游客</p><p>
标题:分享简单的聊天室程序的php代码<br/>
正文:<br/>
核心逻辑在定义应用程序的核心功能之前，先来看一看聊天应用程序的基本外观，如以下截图所示：通过聊天窗口底部的输入框输入聊天文本。点击Send按钮，就开始执行函数set_chat_msg。这是一个基于Ajax的函数，因此无需刷新页面就可以将聊天文本发送到服务器。程序在服务器中执行chat_send_ajax.php以及用户名和聊天文本。// // Set Chat Message //  function set_chat_msg() {   if(typeof XMLHttpRequest != &amp;quot;undefined&amp;quot;)   {     oxmlHttpSend = new XMLHttpRequest();   }   else if (window.ActiveXObject)   {     oxmlHttpSend = new ActiveXObject(&amp;quot;Microsoft.XMLHttp&amp;quot;);   }   if(oxmlHttpSend == null)   {     alert(&amp;quot;Browser does not support XML Http Request&amp;quot;);     return;   }    var url = &amp;quot;chat_send_ajax.php&amp;quot;;   var strname=&amp;quot;noname&amp;quot;;   var strmsg=&amp;quot;&amp;quot;;   if (document.getElementById(&amp;quot;txtname&amp;quot;) != null)   {     strname = document.getElementById(&amp;quot;txtname&amp;quot;).value;     document.getElementById(&amp;quot;txtname&amp;quot;).readOnly=true;   }   if (document.getElementById(&amp;quot;txtmsg&amp;quot;) != null)   {     strmsg = document.getElementById(&amp;quot;txtmsg&amp;quot;).value;     document.getElementB<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2240&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2240&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2240&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2240&amp;Page=3">[3]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=2240&amp;Page=5">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=2240">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=2240">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>