新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> XML网站展示,XML源代码,XML编程示例。 本版仅接受原创、转贴、网站展示,具体的技术交流请前往各相关版块。
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 XML源码及示例(仅原创和转载) 』 → [转载]XMLHTTP+Javascript+Asp写得聊天室,无刷新实现 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 15893 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: [转载]XMLHTTP+Javascript+Asp写得聊天室,无刷新实现 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     admin 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      头衔:W3China站长
      等级:计算机硕士学位(管理员)
      文章:5255
      积分:18406
      门派:W3CHINA.ORG
      注册:2003/10/5

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给admin发送一个短消息 把admin加入好友 查看admin的个人资料 搜索admin在『 XML源码及示例(仅原创和转载) 』的所有贴子 点击这里发送电邮给admin  访问admin的主页 引用回复这个贴子 回复这个贴子 查看admin的博客楼主
    发贴心情 [转载]XMLHTTP+Javascript+Asp写得聊天室,无刷新实现

    转自: 联讯浩天-技术站
    http://www.lssky.net/Article_Show.asp?ArticleID=457
    http://www.lssky.net/Article_Show.asp?ArticleID=456
    http://www.lssky.net/Article_Show.asp?ArticleID=455
    http://www.lssky.net/Article_Show.asp?ArticleID=454
    http://www.lssky.net/Article_Show.asp?ArticleID=453
    http://www.lssky.net/Article_Show.asp?ArticleID=452

    XMLHTTP+Javascript+Asp写得聊天室,无刷新实现 

    [ 作者:佚名    转贴自:本站原创    点击数:1    更新时间:2004-1-16    文章录入:7788zpt ] 

    使用XML.而无须不断刷新*.ASP.
    无刷新实现发言的逐条显示.
    使用Application变量存储聊天记录,所以要需要建立一个虚拟目录
    服务器端不需要支持XML,只要支持ASP和能建立虚拟目录就可以了.
    以下代码在nt4.0+iis4.0上通过.我估计在你的win2000下也差不多吧.
    如果有问题,请多多赐教:netnice@chinaok.net

    ##########index.asp##############################

    <html>
    <head>
    <title>蓝蝶聊天室 Www.ChinaOk.net</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style TYPE="text/css">
    BODY{FONT-SIZE: 9pt}
    TD{FONT-SIZE: 9pt}
    .tbljm{BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid;color:#000000;}
    </style>
    <script language="javascript">
    function openWin()
    {winst="Status=yes,scrollbars=yes,resizable=yes,width="+(screen.availWidth-10)+",height="+(screen.availHeight-50)+",top=0,left=0";
    window.open('about:blank','7923sdfsdfs',winst);
    }
    function form_onsubmit(obj)
    { var no=0,psd="1234567890";
    if(obj.UserName.value==""){alert("请输入你的昵称!\n"); obj.UserName.focus(); return false;}
    if(obj.UserName.value.indexOf(" ")>-1 ||obj.UserName.value.indexOf("'")>-1 || obj.UserName.value.indexOf("\"")>-1){alert("你的昵称含有非法字符!\n"); obj.UserName.focus(); return false;}
    openWin();
    return true;
    }
    </script>
    </head>

    <body bgcolor="#ffffff" text="#000000" valign="center" onload="javascript:document.form1.ok.blur()" background="images/greystrip.gif">
    <center><TABLE border=0 width="67%">
    <TBODY>
    <TR>
    <TD valign=center align="middle" style="FONT-SIZE: 10.5pt"><FONT color=#0033ff>::::: :::::</FONT> </TD>
    </TR></TBODY></TABLE></center>
    <table width="200" border="0" style="BORDER-RIGHT: #003366 1px solid; BORDER-TOP: #003366 1px solid; BORDER-LEFT: #003366 1px solid; BORDER-BOTTOM: #003366 1px solid" cellspacing="0" cellpadding="0" align="center">
    <tr>
    <td bgcolor="#304d7c" height="25">
    <div align="center"><font color="#ffffff">用户登陆</font></div>
    </td>
    </tr>
    <tr>
    <td height="121">
    <form name="form1" method="post" action="main.asp" onSubmit="return form_onsubmit(this)" target="7923sdfsdfs">

    <table width="199" border="0" cellspacing="0" cellpadding="0" background="images/greystrip.gif">
    <tr>
    <td height="35">
    <div align="center">用户名:
    <input name="UserName" size="10" maxlength="20" class=tbljm>
    </div>
    </td>
    </tr>
    <tr>
    <td height="41">
    <div align="center">性 别:
    <input type=radio value="0" name=sx checked>男 | <input type="radio" value="1" name=sx>女
    </div>
    </td>
    </tr>
    <tr>
    <td height="40">
    <div align="center">
    <input type="submit" name="ok" value="登 陆" class=tbljm>
    <input type="reset" name="nook" value="重 写" class=tbljm><BR><br><font color=red>演示xmlHttp实现的无刷新技术<br>代码可下载</font><br></div>
    </td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table>
    </body>
    </html>

    ################main.asp######################

    <%Response.Buffer=true
    Response.Expires=0
    userName=Request.Form("username")
    if username="" then Response.Redirect "index.asp"
    session("u_name")=username
    if Request.Form("sx")="1" then
    session("u_sx")="1"
    else
    session("u_sx")="0"
    end if
    %>
    <html>

    <head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <link REL="SHORTCUTICON" url="images/Bluenote.ico">
    <title>蓝蝶聊天室::欢迎您! Www.ChinaOk.net .............蓝蝶精品网.............Www.ChinaOk.net</title>
    <style>
    .fbd{BORDER-BOTTOM-COLOR: #3A5C9F; BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-COLOR: #3A5C9F; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-COLOR: #3A5C9F; BORDER-RIGHT-STYLE: solid; BORDER-TOP-COLOR: #3A5C9F; BORDER-TOP-STYLE: solid}
    .topc{bgcolor:#ffff00}
    </style>
    <script Language="javascript">
    self.onerror=null;
    var nullframe = '<HTML><BODY BGCOLOR=#003366 text=#ffffff><center><H3 color=#ffffff>正在读取资料, 请稍候 ......</h3></center></BODY></HTML>';
    </script>
    </head>
    <frameset cols="*,0" rows="*" class=topc>
    <frameset rows="*,75" cols='*' framespacing="0" frameborder="1" border="0" >
    <frameset rows="45%,*" cols='*' framespacing="1" border="1" name="content" frameborder='YES' class=topc>
    <frame name="pub" src="javascript:parent.nullframe" scrolling="auto" frameborder=1 >
    <frame name="my" src="javascript:parent.nullframe" scrolling="auto" frameborder=1>
    </frameset>
    <frame name="sd" scrolling="no" noresize src="send.asp" >
    </frameset>
    <noframes>
    <p>此网页使用了框架,但您的浏览器不支持框架。</p>

    </body>
    </noframes>
    </frameset>
    </html>

    ################reload.asp##############

    <%'Response.ContentType="text/xml"
    Response.Write "<?xml version=""1.0"" encoding=""GB2312""?>"
    Response.Write "<Msg>"
    dim c_info,c_Lid,c_Ip,u_Lid,NewLid,u_name,i
    c_info=Application("c_info")
    u_Lid=session("u_Lid")
    newLid=u_Lid
    u_name="netnice"
    for i=c_info(0)+6 to 240 step 6
    if (c_info(i)>u_Lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then
    Response.Write c_info(i+5)
    if (newLid<c_info(i)) then newLid=c_info(i)
    end if
    next
    for i=1 to c_info(0) step 6
    if (c_info(i)>u_Lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then
    Response.Write c_info(i+5)
    if (newLid<c_info(i)) then newLid=c_info(i)
    end if
    next
    Response.Write "</Msg>"
    session("u_Lid")=newLid
    %>

    ########say.asp##############

    <% Option Explicit
    dim F,T,sC,cL,E,W,sJ
    Response.ContentType="text/xml"
    F=Request.Form ("F")
    T=Request.Form ("T")
    sC=Request.Form ("sC")
    cL=Request.Form ("cL")
    E=Request.Form("E")
    'W=Request.Form("W")
    W="0"
    '发言时间
    sJ=getTime()
    if Request.ServerVariables("REQUEST_METHOD")="POST" then
    sC="<F>"&trim(F)&"</F><T>"&trim(T)&"</T><E>"&E&"</E><sC>"&trim(sC)&"</sC><cL>"&trim(cL)&"</cL><sJ>"&sJ&"</sJ>"
    else
    Response.End
    end if
    dim c_info,c_Lid,c_Ip,u_Lid,NewLid,u_name,i
    Application.Lock
    c_info=Application("c_info")
    c_Lid=Application("c_Lid")+1
    Application("c_Lid")=c_Lid
    c_Ip=(c_info(0)+6) mod 240
    c_info(0)=c_Ip
    c_info(c_Ip)=c_Lid
    c_info(c_Ip+1)=F
    c_info(c_Ip+2)=T
    c_info(c_Ip+3)=W
    c_info(c_Ip+4)=""
    c_info(c_Ip+5)=sC '"<F>"&trim(F)&"</F><T>"&trim(T)&"</T><E>"&E&"</E><sC>"&trim(sC)&"</sC><cL>"&trim(cL)&"</cL><sJ>"&sJ&"</sJ>"
    Application("c_info")=c_info
    Application.UnLock
    u_Lid=session("u_Lid")
    newLid=u_Lid
    u_name=session("u_name")
    '&Application("c_Lid")&"%"&c_info(0)

    Response.Write "<?xml version=""1.0""?><Msg>"
    for i=c_info(0)+6 to 240 step 6
    if (c_info(i)>u_Lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then
    Response.Write c_info(i+5)
    if (newLid<c_info(i)) then newLid=c_info(i)
    end if
    next
    for i=1 to c_info(0) step 6
    if (c_info(i)>u_Lid) and ((c_info(i+1)=u_name) or (c_info(i+2)=u_name) or (c_info(i+2)="大家") or (c_info(i+3)="0")) then
    Response.Write c_info(i+5)
    if (newLid<c_info(i)) then newLid=c_info(i)
    end if
    next

    Response.Write "</Msg>"
    session("u_Lid")=newLid

    function getTime()
    dim y,m,d,h,n,s
    y=Year(date())
    m=Month(date())
    d=Day(date())
    h=Hour(time())
    n=Minute(time())
    s=Second(time()) '当为是一位的 时候在前面加0
    if len(m)=1 then m="0" & m
    if len(d)=1 then d="0" & d
    if len(h)=1 then h="0" & h
    if len(n)=1 then n="0" & n
    if len(s)=1 then s="0" & s
    getTime=y&"/"&m&"/"&d &" " & h&":"& n&":"&s
    end function%>

    这是最重要的一个了。也很大。我的习惯不太好。没有加详细的注释,认真看吧。
    #########send.asp##############
    <html>
    <head>
    <META content="text/html; charset=gb2312" http-equiv=Content-Type>
    <meta http-equiv='pragma' content='no-cache'>
    <link REL="SHORTCUTICON" url="images/Bluenote.ico">
    <style type="text/css">
    td{font-family: "宋体"; font-size: 9pt}
    body { font-family: "宋体"; font-size: 9pt}
    select { font-family: "宋体"; font-size: 9pt}
    .p9{font-family:"宋体";font-size:9pt;line-height:130%; width:68px;}
    A {cursor:hand;text-decoration:none; font-family: "宋体"; font-size: 9pt;}
    input{font-size:9pt}
    .an{background-color:FFFFFF;color:000000;border: 1 double}
    </style>
    <title>发言</title>
    <script Language=javascript>
    var tmp0="$F对$T说:|无表情|$F向$T微微一笑:|微笑|$F笑嘻嘻地对$T说:|嘻笑|$F冲$T傻乎乎的笑笑:|傻笑|$F对$T娇笑着:|娇笑|$F对着$T哈哈大笑:|大笑|$F看着$T,心头一阵狂喜:|狂喜|$F冲着$T狂笑不已:|狂笑|$F对$T奸笑着:|奸笑|$F咯咯一笑,很大方地对$T说:|大方|$F紧紧地握住$T的手:|握手|$F向$T挥了挥手:|挥手|$F耸耸肩,两手一摊:$T,|耸肩1|$F无奈地耸耸肩:$T,|耸肩2|$F摸摸$T的头,细声安慰:|安慰|$F笑呵呵向$T一拱手:|拱手|$F很有礼貌地对$T作了一揖:|作揖|$F深深地鞠了一躬:$T,|鞠躬|$F不好意思地对$T说:|歉意|$F瞪大了眼睛,很讶异地看着$T:|讶异|$F大吃一惊:$T,|惊讶|$F茫然地看着$T:|茫然|$F一脸的迷茫:$T,|迷茫|$F颇感迷惑:$T,|迷惑|$F感到很是奇特:$T,|奇特|$F对$T潇洒地一甩头:|潇洒|$F惋惜地看着$T:|惋惜|$F对$T皱了皱眉:|皱眉|$F很遗憾地对$T说:|遗憾|$F大包大揽地向$T承诺:|承诺|$F抓抓头皮,还是不解:$T,|不解|$F提高嗓门,大声地对$T说:|大声|"
    var tmp1="$F不解地问$T:|询问|$F向$T吐了吐舌头:|吐舌|$F非常自信地对$T说:|自信|$F向上天祈祷着,$T,|祈祷|$F向$T噘了噘嘴:|噘嘴|$F嘟着嘴对$T说:|嘟嘴|$F平静地对$T说:|平静|$F高兴地对$T说:|高兴|$F在$T耳边悄悄地说:|耳语|$F眯着小眼睛对$T说:|眯眼|$F眼波晶莹明亮地看着$T:|眼亮|$F幸福地看着$T:|幸福|$F很满足地对$T说:|满足|$F轻轻牵着$T的手,小声地说:|牵手|$F轻轻推了$T一下:|轻推|$F粘粘糊糊地向$T撒娇:|撒娇|$F对$T做了个鬼脸:|鬼脸|$F神秘兮兮地对$T说:|神秘|$F脸上泛起了红晕,低着头小声地对$T说:|脸红|$F低着头,玩弄着自己的手指,羞得满脸通红:$T,|害羞|$F小猫猫般地依偎在$T的怀中:|依偎|$F拍了拍$T那脏兮兮的小脸蛋:|拍脸|$F向$T抛去一个媚眼:|媚眼|$F恶狠狠地冲$T瞪着眼睛:|瞪眼|$F柔声地对$T说:|柔声|$F情意绵绵地望着$T说:|深情|$F温柔地抱住$T说:|拥抱|$F亲了亲$T的脸:|亲亲|$F恋恋不舍地拉着$T的衣角:|不舍|"
    var tmp2="$F运足气一声断喝:$T!|断喝|$F幸灾乐祸地对$T说:|幸灾|$F露出无可奈何的表情:$T,|无奈|$F使劲敲敲自己脑门,看着$T:|拍脑|$F顾作沉思状:$T,|沉思|$F一付无辜的样子:$T,|无辜1|$F感到非常无辜,$T:|无辜2|$F感觉很不舒服:$T,|不适|$F打个大哈欠:$T,|哈欠|$F口吐白沫,晕倒在地:$T,|白沫|$F感到无聊极了:$T,|无聊|$F看着$T,快要吐了:|想吐|$F一脸无赖泼皮样子:$T,|无赖|$F歪着看着$T,二球劲十足:|二球|$F双眼盯着$T,奴才嘴脸十足:|奴才|$F委屈地对$T说:|委屈|$F大感沮丧:$T,|沮丧|$F望着窗外细雨淅淅,不由得双眼朦胧:$T,|伤感|$F悲伤地对$T说:|悲伤|$F泪水在眼框里打着转:$T,|含泪|$F看着$T,快要哭了:|要哭|$F低低抽泣着:$T,|抽泣|$F一把将$T抱住,哭哭涕涕:|抱哭|$F想到伤心处,泪流如注:$T,|大哭|$F抱头放声大哭:$T,|痛哭|$F号淘大哭:$T,|大哭|$F对$T露出失望的表情:|失望|$F用眼角斜视$T,满脸俱是轻蔑不屑之色:|轻蔑|$F生气地对$T说:|生气|"
    var tmp3="$F向$T提出强烈抗议:|抗议|$F对$T大声叫嚷:|叫嚷|$F对$T气愤地嚷道|气愤|$F怨毒地看着$T:|怨毒|$F一把甩掉$T的手,恶恨恨地说:|甩手|$F目光尽赤,冲$T怒不可恶地狂吼:|暴怒|$F打了$T老大一个耳括子:|耳光|$F不客气地猛揍$T一拳:|拳打|$F一脚踢在$T的屁股上:|脚踢|$F向$T点头称是:|点头称是|$F兴高采烈地对$T说:|兴高采烈|$F惊慌失措地对$T说:|惊慌失措|$F幸灾乐祸地对$T说:|幸灾乐祸|$F眉飞色舞地对$T说:|眉飞色舞|$F阴阳怪气地对$T说:|阴阳怪气|$F哭天抢地地对$T说:|哭天抢地|$F牢骚满腹地对$T说:|牢骚满腹|$F理屈词穷地对$T说:|理屈词穷|$F江郎才尽地对$T说:|江郎才尽|$F凶神恶煞地对$T说:|凶神恶煞|$F眉歪眼斜地对$T说:|眉歪眼斜|$F目光凛然地对$T说:|目光凛然|$F声嘶力竭地对$T说:|声嘶力竭|$F意乱情迷地对$T说:|意乱情迷|$F脸色铁青地对$T说:|脸色铁青|$F失魂落魄地对$T说:|失魂落魄|$F目光呆滞地对$T说:|目光呆滞|$F正气凛然地对$T说:|正气凛然|"
    var tmp4="$F手足无措地对$T说:|手足无措|$F无精打采地对$T说:|无精打采|$F依依不舍地对$T说:|依依不舍|$F拳打脚踢地对$T说:|拳打脚踢|$F不怀好意地对$T说:|不怀好意|$F毛手毛脚地对$T说:|毛手毛脚|$F得意洋洋地对$T说:|得意洋洋|$F慨叹万千地对$T说:|慨叹万千"
    var etmp=tmp0+tmp1+tmp2+tmp3+tmp4;
    var eV=etmp.split("|")
    function wh(fn){
    fn.open();
    fn.writeln("<!--★请另存为HTML类型的文件★-->");
    fn.writeln("<html><head><title>对话区</title><meta http-equiv=Content-Type content=\"text/html; charset=gb2312\">");
    fn.writeln("<style type=text/css>.t{color:003366;font-size:9pt;}.pic{font-size:17pt;}body{font-family:\"宋体\";font-size:10.5pt;line-height:160%}A{text-decoration:none}A:Hover{text-decoration:underline}A:visited{color:blue}</style></head><\Script Language=\"javascript1.1\">");
    fn.writeln("var autoScrollOn=1;var scrollOnFunction;var scrollOffFunction;");
    fn.writeln("function scrollit(){ if(!parent.sd.oT.as.checked){autoScrollOn=0;return true;}else{autoScrollOn=1;StartUp();return true;}}function scrollWindow(){if(autoScrollOn==1){this.scroll(0,65000);setTimeout('scrollWindow()',200);}}function scrollOn(){autoScrollOn=1;scrollWindow();}function scrollOff(){autoScrollOn=0;}function StartUp(){parent.onblur=scrollOnFunction;parent.onfocus=scrollOffFunction;scrollWindow();}");
    fn.writeln("scrollOnFunction=new Function('scrollOn()');");
    fn.writeln("scrollOffFunction=new Function('scrollOff()');");
    fn.writeln("StartUp();</\script>");return;
    }
    function write(){
    wh(parent.pub.document);
    parent.pub.document.writeln("<body text=#000000 bgcolor=#eeeeff >");
    parent.pub.document.writeln("<div id=\"div0\"></div>◆<span style='color:#ff0088'>蓝蝶聊天室</span>◆中心大厅<br>轻轻敲醒沉睡的心灵,慢慢张开你的眼睛,让那昨日的忧伤随聊而去!<hr size=1><div id=Ly></Ly>");
    wh(parent.my.document);
    var myd=parent.my.document;
    myd.writeln("<body text=#000000 bgcolor=#eeeeff >");
    myd.writeln("<div id=\"div0\"></div>◆<span style='color:#ff0088'>蓝蝶聊天室</span>◆温馨包厢<br>");
    myd.writeln("<span style='color:#0000ff;font-size:9pt'>[这是您的个人包厢,只显示和您相关的发言!]</span><hr size=1><div id=Ly></div>");
    }
    </script>
    <script language="vbscript">
    Function URLEncoding(vstrIn)
    strReturn = ""
    For i = 1 To Len(vstrIn)
    ThisChr = Mid(vStrIn,i,1)
    If Abs(Asc(ThisChr)) < &HFF Then
    strReturn = strReturn & ThisChr
    Else
    innerCode = Asc(ThisChr)
    If innerCode < 0 Then
    innerCode = innerCode + &H10000
    End If
    Hight8 = (innerCode And &HFF00)\ &HFF
    Low8 = innerCode And &HFF
    strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
    End If
    Next
    URLEncoding = strReturn
    End Function

    Function bytes2BSTR(vIn)
    strReturn = ""
    For i = 1 To LenB(vIn)
    ThisCharCode = AscB(MidB(vIn,i,1))
    If ThisCharCode < &H80 Then
    strReturn = strReturn & Chr(ThisCharCode)
    Else
    NextCharCode = AscB(MidB(vIn,i+1,1))
    strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
    i = i + 1
    End If
    Next
    bytes2BSTR = strReturn
    End Function
    </script>
    <script language="javascript">
    var Me="<%=session("u_name")%>";
    <%if session("u_sx")="1" then %>
    var Msx="girl.gif";
    <%else%>
    var Msx="boy.gif";
    <%end if%>
    var Ts=new oS();
    function oS()
    {this.F="";
    this.T="";
    this.E="";
    this.W="0";
    this.sC="";
    this.cL="";
    this.Send=sendMsg;
    }
    function checksays()
    {if (document.say.says.value=="") {alert("你要说什么呢?");return false;}
    var fm=document.say;
    var sC=fm.says.value;
    var F=Me
    var T=fm.T.options[0].value;
    var E=document.oT.userface.selectedIndex;
    var W="0"
    var cL=fm.says.style.color;
    fm.says.value="";
    fm.says.focus();
    Ts.F=F;
    Ts.T=T;
    Ts.E=E;
    Ts.sC=sC;
    Ts.cL=cL;
    Ts.W=W;
    setTimeout("Ts.Send();",20);
    delete(F);delete(sC);delete(fm);delete(cL);delete(T);delete(E);
    return false;
    }
    function sendMsg()
    { if (this.T=="" && this.F=="") {alert("你要对谁说?");return;}
    cRld=1;
    var sS="F="+code(this.F)+"&T="+code(this.T)+"&sC="+code(this.sC)+"&cL="+this.cL+"&E="+this.E;
    sS=URLEncoding(sS)
    var oSend=new ActiveXObject("Microsoft.XMLHTTP");
    oSend.open("POST","say.asp",false);
    oSend.setRequestHeader("Content-Length",sS.length);
    oSend.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");//没有这句就玩不转拉
    oSend.send(sS);
    var oDom=new ActiveXObject("Microsoft.XMLDOM");
    oDom.async=false;
    body=bytes2BSTR(oSend.responseBody);
    // alert(body);
    oDom.loadXML(body);
    if(oDom.parseError.errorCode != 0)
    { alert(body);
    alert("Sorry.出现了错误");
    return }
    else
    {var aryF=oDom.documentElement.selectNodes("F");
    var aryT=oDom.documentElement.selectNodes("T");
    var arysC=oDom.documentElement.selectNodes("sC");
    var arycL=oDom.documentElement.selectNodes("cL");
    var arysJ=oDom.documentElement.selectNodes("sJ");
    var aryE=oDom.documentElement.selectNodes("E");
    var tmpHtml="";
    var img="";
    lengt=aryF.length;
    for(var i=0;i<lengt;i++){
    img="<img src=boy.gif width=12 height=12 border=0>";
    tmpHtml="<font style=\'cursor:hand;color:"+arycL(i).text+"\'>"+document.oT.userface.options[aryE(i).text].value+rp2(arysC(i).text,"{^amp]","&")+"</font> <span class=t>["+arysJ(i).text+"]</span><br>";
    tmpHtml=rp2(tmpHtml,"$F","<a href=\"javascript:parent.sd.towho('"+aryF(i).text+"');\">"+img+aryF(i).text+"</a>");
    tmpHtml=rp2(tmpHtml,"$T","<a href=\"javascript:parent.sd.towho('"+aryT(i).text+"');\">"+aryT(i).text+"</a>");
    if (aryF(i).text==Me || aryT(i).text==Me)
    { parent.my.Ly.innerHTML+=tmpHtml;
    } else
    parent.pub.Ly.innerHTML+=tmpHtml;
    }// end for
    }
    delete(aryF);delete(aryT);delete(arysC);delete(arycL);delete(arysJ);delete(aryE);
    delete(oDom)
    delete(oSend)
    delete(tmpHtml)
    }
    function code(Str)
    {var A = new RegExp("'","gi")
    var B = new RegExp("\"","gi")
    Str = Str.replace(/&/gi,"&")
    Str = Str.replace(/</gi,"<")
    Str = Str.replace(/>/gi,">")
    Str = Str.replace(B,""")
    Str = Str.replace(/&/gi,"{^amp]")
    delete(A)
    delete(B)
    return(Str)
    }
    function rp2(Str,Fs,Is)
    {while (Str.indexOf(Fs)!=-1)
    Str = Str.replace(Fs,Is)
    delete(A);
    return(Str)
    }
    var oRDom=new ActiveXObject("Microsoft.XMLDOM");
    oRDom.async=false;
    var Path="reload.asp";
    var tCok;
    function Clock()
    {cRld++;
    if (cRld>10){cRld=1;GetXmlData();}
    clearTimeout(tCok);
    tCok=setTimeout("Clock()",1000);
    }
    function GetXmlData() //这就是刷新用户XML数据的函数
    {cRld=1;
    oRDom.load(Path)
    if(oRDom.parseError.errorCode != 0)
    {alert("Sorry.出现了错误");
    return }
    else
    {
    var aryF=oRDom.documentElement.selectNodes("F");
    var aryT=oRDom.documentElement.selectNodes("T");
    var arysC=oRDom.documentElement.selectNodes("sC");
    var arycL=oRDom.documentElement.selectNodes("cL");
    var arysJ=oRDom.documentElement.selectNodes("sJ");
    var aryE=oRDom.documentElement.selectNodes("E");
    var tmpHtml="";
    lengt=aryF.length;
    for(var i=0;i<lengt;i++){
    img="<img src=girl.gif width=12 height=12 border=0>";
    tmpHtml="<font style=\'cursor:hand;color:"+arycL(i).text+"\'>"+eV[aryE(i).text*2]+rp2(arysC(i).text,"{^amp]","&")+"</font> <span class=t>["+arysJ(i).text+"]</span><br>";
    tmpHtml=rp2(tmpHtml,"$F","<a href=\"javascript:parent.sd.towho('"+aryF(i).text+"');\">"+img+aryF(i).text+"</a>");
    tmpHtml=rp2(tmpHtml,"$T","<a href=\"javascript:parent.sd.towho('"+aryT(i).text+"');\">"+aryT(i).text+"</a>");
    if (aryF(i).text==Me || aryT(i).text==Me)
    { parent.my.Ly.innerHTML+=tmpHtml;
    } else
    parent.pub.Ly.innerHTML+=tmpHtml;
    }
    }
    delete(aryF);delete(aryT);delete(arysC);delete(arycL);delete(arysJ);
    }
    function towho(un){
    document.say.T.options[0].value=un;
    document.say.T.options[0].text=un;
    document.say.says.focus();return;}
    </script>
    <base onmouseover="parent.window.status='欢迎光临 蓝蝶精品网 www.ChinaOk.net 站长:NetNice QICQ:6097356 ';return true;">
    </head>
    <body bgcolor="#76b4d9" topmargin="4" leftmargin="1" >
    <table BORDER="0" width="767" cellspacing="0" cellpadding="0" >
    <tr><td width="735" height="16" align="left" nowrap>
    <form method="post" action="save.asp" name="say" target="b" onsubmit='return(checksays());'>
    <input type="hidden" name="oldsays" >
    <input name="F" maxlength="10" size="10" value="<%=session("u_name")%>" readonly style="BACKGROUND-COLOR: #76aadd; BORDER-BOTTOM: 0px double; BORDER-LEFT: 0px double; BORDER-RIGHT: 0px double; BORDER-TOP: 0px double; COLOR: #ffffff; TEXT-ALIGN: right">
    对 <select name="T" onclick="this.options[0].value='大家'; document.say.T.options[0].text='大家'; document.say.says.focus();" >
    <option value="大家" selected>大家</option>
    </select> 说:<input type=text name="says" maxlength="150" size="50" style="BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: 1px double; BORDER-LEFT: 1px double; BORDER-RIGHT: 1px double; BORDER-TOP: 1px double; COLOR: #000000" accesskey="t" title="发表对话区(Alt+T)可激活!" LANGUAGE="javascript ">
    <input type="submit" name="send" value="发言" class="an" accesskey="s" onmouseover="this.style.color='3366dd'" onmouseout="this.style.color='663300'" title="(Alt+S)">
    </form></td></tr></table>
    <div style="HEIGHT: 80px; LEFT: 15px; POSITION: absolute; TOP: 30px; WIDTH: 600px">
    <form name="oT">
    <table BORDER="0" width="600" cellspacing="0" cellpadding="0">
    <tr>
    <td width="160" height="16" align="center" nowrap valign="top">
    <input accesskey="a" type="checkbox" name="as" checked onclick="parent.pub.scrollit();parent.my.scrollit();document.say.says.focus();"><A onclick=moveself(); title=" “激活/禁止”对话区自动滚屏(Alt+A)!">滚屏</A>

    </td>
    <td width="230" height="16" align="left" nowrap valign="top"> <span title=" 改变你的发言的字体颜色(Alt+F)!">
    <select name=usercolor accesskey="f" onchange="document.say.says.style.color=this.options[this.selectedIndex].value;">
    <OPTION selected style="COLOR: #000000" value="000000">默认颜色</OPTION>
    <OPTION style="COLOR: #000000" value="#000000">黑色沉静</OPTION>
    <option style="COLOR: #ff0000" value='#FF0000'>红色热情</option>
    <option style="COLOR: #0000ff" value='#0000FF'>蓝色开朗</option>
    <option style="COLOR: #ff00ff" value='#FF00FF'>桃色浪漫</option>
    <option style="COLOR: #009900" value='#009900'>绿色青春</option>
    <option style="COLOR: #009999" value='#009999'>青色清爽</option>
    <option style="COLOR: #990099" value='#990099'>紫色拘谨</option>
    <option style="COLOR: #990000" value='#990000'>暗夜兴奋</option>
    <option style="COLOR: #000099" value='#000099'>深蓝忧郁</option>
    <option style="COLOR: #999900" value='#999900'>卡其制服</option>
    <option style="COLOR: #ff9900" value='#FF9900'>镏金岁月</option>
    <option style="COLOR: #0099ff" value='#0099FF'>湖波荡漾</option>
    <option style="COLOR: #9900ff" value='#9900FF'>发亮蓝紫</option>
    <option style="COLOR: #ff0099" value='#FF0099'>爱的暗示</option>
    <option style="COLOR: #006600" value='#006600'>墨绿深沉</option>
    <option style="COLOR: #333333" value='#333333'>灰色轨迹</option>
    <option style="COLOR: #999999" value='#999999'>伦敦灰雾</option>
    </select></span>
    <span title=" 改变您的说话时的表情(Alt+Q)!" ><select accesskey="q" name=userface style="FONT-SIZE: 9pt;width:65px" size="1">
    <script language="javascript">
    for(var iF=0;iF<eV.length;iF+=2)
    {document.writeln("<option value=\""+eV[iF]+"\">"+eV[iF+1]);
    }
    </script>
    </select></span> <input TYPE="checkbox" name="ws" id="ws" accesskey="m" ><A title=" 和聊友说句悄悄话(Alt+M)!"><label for=ws >私聊</label></A> </td>
    <td width="250" height="16" align="left" nowrap valign="top">
    <INPUT id=clock name=clock type=button value=1200 class="an" title="如果您长时间不发言(潜水),请注意:当计数器减至零时,您将被被踢出!" style="color:#ff3300;width:60;" disabled>
    </td>
    </tr>
    </table> </form>
    </div>
    <script>
    write();
    GetXmlData();
    Clock();
    </script>
    </body>
    </html>


       收藏   分享  
    顶(1)
      




    ----------------------------------------------

    -----------------------------------------------

    第十二章第一节《用ROR创建面向资源的服务》
    第十二章第二节《用Restlet创建面向资源的服务》
    第三章《REST式服务有什么不同》
    InfoQ SOA首席编辑胡键评《RESTful Web Services中文版》
    [InfoQ文章]解答有关REST的十点疑惑

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/1/29 20:15:00
     
     houya 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:6
      积分:70
      门派:XML.ORG.CN
      注册:2004/3/26

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给houya发送一个短消息 把houya加入好友 查看houya的个人资料 搜索houya在『 XML源码及示例(仅原创和转载) 』的所有贴子 引用回复这个贴子 回复这个贴子 查看houya的博客2
    发贴心情 
    是不是少了一个 save。asp 啊 运行不了
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/4/28 17:02:00
     
     nerd 帅哥哟,离线,有人找我吗?水瓶座1985-2-2
      
      
      头衔:Nerd
      等级:大一(高数修炼中)
      文章:4
      积分:114
      门派:XML.ORG.CN
      注册:2004/4/1

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给nerd发送一个短消息 把nerd加入好友 查看nerd的个人资料 搜索nerd在『 XML源码及示例(仅原创和转载) 』的所有贴子 引用回复这个贴子 回复这个贴子 查看nerd的博客3
    发贴心情 我也试过,就是少了个文件!
    我也试过,就是少了个文件!
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2004/4/29 13:05:00
     
     kolibai 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:7
      积分:85
      门派:XML.ORG.CN
      注册:2005/9/9

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给kolibai发送一个短消息 把kolibai加入好友 查看kolibai的个人资料 搜索kolibai在『 XML源码及示例(仅原创和转载) 』的所有贴子 引用回复这个贴子 回复这个贴子 查看kolibai的博客4
    发贴心情 
    那个应该是源文件里写错了,把send.asp里那个“save.asp”改成“send.asp”试试
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/9/15 22:55:00
     
     小松鼠 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:0
      积分:56
      门派:XML.ORG.CN
      注册:2006/5/13

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给小松鼠发送一个短消息 把小松鼠加入好友 查看小松鼠的个人资料 搜索小松鼠在『 XML源码及示例(仅原创和转载) 』的所有贴子 引用回复这个贴子 回复这个贴子 查看小松鼠的博客5
    发贴心情 
    我改了还是不行
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2006/5/17 17:37:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 XML源码及示例(仅原创和转载) 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/11/28 19:55:49

    本主题贴数5,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    304.688ms