网页聊天内核 自己编写比较好的方法
<?php error_reporting(0); session_start(); include("conn.php"); $sqlu=mysql_query("select m.* ,n.* from tb_user as m,xxq_area n where m.areaid=n.areaid and m.usernc='test'",$conn); $infou=mysql_fetch_array($sqlu); $sheng_daima=substr($infou[daima],0,2); $sql_s=mysql_query("select * from xxq_area where daima=".$sheng_daima."0000",$conn); $info_s=mysql_fetch_array($sql_s); $chengshiid=$infou[areaid]; //默认城市areaid ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="jquery_v1.6.2.js"></script> <link type="text/css" href="img0105/css.css" rel="stylesheet" /> <script type="text/javascript"> //此函数作用为调用父页面的函数 由子页面进行控制 function chatwith(x){ parent.chat_one_to_one(x); } </script> <script type="text/javascript"> //调用父窗口的发布广播功能 function guangbo_add(){ parent.guangbo_add(); } </script> <script type="text/javascript"> //控制子iframe滚动 function control_gundong(){ document.getElementById('myIframe').contentWindow.control_this_gundong(); } </script> <script type="text/javascript"> //关闭AJAX相应的缓存 $.ajaxSetup ({ cache: false }); </script> <script type="text/javascript"> var url_base = 'aaa_reader8.php'; var url_base_tj = 'aaa_reader2_tj.php'; var now_areaid='1674'; //当前的areaid var now_catid='0'; //当前的catid var url_now; //当前的链接地址 var arr_areaid=new Array('1674^全潍坊','1676^潍城','1677^寒亭','1678^坊子','1679^奎文','1680^高新','1681^滨海','1682^临朐','1683^昌乐','1684^青州','1685^诸城','1686^寿光','1687^安丘','1688^高密','1689^昌邑'); var arr_catid=new Array('0^全频道','1^房屋信息','2^跳蚤市场','3^车辆服务','4^宠物','5^票务|卡券','6^装修建材','7^招聘','8^求职','9^生活服务','10^商业服务','11^餐饮美食','12^娱乐休闲','13^医疗健康','14^教育培训','15^旅游酒店','16^招商加盟'); //加载页面执行函数 function before_load(){ document.getElementById('areaid_1674').style.color = '#ff0000'; document.getElementById('catid_0').style.color = '#ff0000'; } //更改地址的areaid参数 function select_areaid_iframe(){ now_areaid = document.getElementById("select_areaid").value; url_now = url_base+'?areaid='+now_areaid+'&catid='+now_catid; url_now_tj = url_base_tj+'?areaid='+now_areaid+'&catid='+now_catid; document.getElementById("myIframe").src = url_now; document.getElementById("myIframe_tj").src = url_now_tj; //alert(url_now); } //更改地址的catid参数 function select_catid_iframe(){ now_catid = document.getElementById("select_catid").value; url_now = url_base+'?areaid='+now_areaid+'&catid='+now_catid; url_now_tj = url_base_tj+'?areaid='+now_areaid+'&catid='+now_catid; document.getElementById("myIframe").src = url_now; document.getElementById("myIframe_tj").src = url_now_tj; //alert(url_now); } </script> </head> <body onLoad="before_load();" oncontextmenu=self.event.returnValue=false onselectstart="return false" STYLE="background-color:transparent"> <div class="chat_all"> <div class="chat_content"> <iframe id="myIframe" allowTransparency="true" scrollbar="yes" frameborder="no" src="aaa_reader8.php?areaid=1674&catid=0" width="335" height="200"></iframe> <div class="chat_tiaojian"> <div class="chat_l"> 地区 <select class="chat_tj_xz" id="select_areaid" onChange="select_areaid_iframe()" > <option value="1674">全潍坊</option> <option value="1676">潍城</option> <option value="1677">寒亭</option> <option value="1678">坊子</option> <option value="1679">奎文</option> <option value="1680">高新</option> <option value="1681">滨海</option> <option value="1682">临朐</option> <option value="1683">昌乐</option> <option value="1684">青州</option> <option value="1685">诸城</option> <option value="1686">寿光</option> <option value="1687">安丘</option> <option value="1688">高密</option> <option value="1689">昌邑</option> </select> 分类 <select class="chat_tj_xz" id="select_catid" onChange="select_catid_iframe()" style="width:80px;"> <option value="0">全频道</option> <option value="1">房屋信息</option> <option value="2">跳蚤市场</option> <option value="3">车辆服务</option> <option value="4">宠物</option> <option value="5">票务|卡券</option> <option value="6">装修建材</option> <option value="7">招聘</option> <option value="8">求职</option> <option value="9">生活服务</option> <option value="10">商业服务</option> <option value="11">餐饮美食</option> <option value="12">娱乐休闲</option> <option value="13">医疗健康</option> <option value="14">教育培训</option> <option value="15">旅游酒店</option> <option value="16">招商加盟</option> </select> </div> <div class="chat_tj_button"><a href="#" ><img src="img0105/chat_button1.png" onClick="guangbo_add();" onMouseOver="this.src='img0105/chat_button2.png'" onMouseOut="this.src='img0105/chat_button1.png'" width="82" height="26"></a></div> </div> <button id="gundong" onClick="control_gundong();" class="gundong" style="display:none;">滚动</button> <textarea id="content" cols="10" rows="1" style="display:none;"></textarea> <button onClick="post_data();" style="display:none;">发布</button> <span style="display:none;"> <input id="my_color" value="#000000"> <select id="my_size"> <option value="12">12像素</option> <option value="13">13像素</option> <option value="14">14像素</option> <option value="15">15像素</option> <option value="16">16像素</option> </select> </span> <iframe id="myIframe_tj" class="iframe_tj" scrollbar="no" frameborder="no" src="aaa_reader2_tj.php?areaid=1674&catid=0" width="200" height="18"></iframe> </div> </div> </body> </html>