• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

模拟qq的复制聊天记录到发消息框

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 39次 | 进入软件测试论坛讨论

领测软件测试网 接上-----“模拟qq的消息接收”
    qq 的消息发送界面提供了聊天记录,并且你可以通过鼠标轻松地、重复地把聊天记录复制到发消息框里,下面就是我提供的web页里实现的方法(注:此页面的来源为天乐的picq,小白只是添加了一个函数和自己的asp代码,实现了复制的功能!)
下面是显示聊天记录页的主要代码:
    
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">             
     <%
     
     ‘’取出聊天记录
     touser=trim(server.HTMLEncode (Request.QueryString ("touser")))
     
     ‘’和该好友的聊天记录
     sql="select * from msg  where (sender=‘’"&session("icqusername")&"‘’ and receiver=‘’"&touser&"‘’ ) or ( sender=‘’"&touser&"‘’ and receiver=‘’"&session("icqusername")&"‘’ ) order by msgdate desc"
    on error resume next    
    rs.open sql,conn,1,3
    if Err.number <> 0 then
    response.write Err.description
    ‘’else
    ‘’response.write rs.recordcount
    end  if
    do while not rs.eof
     %>   
  <tr>      
  <!--
  这里实现复制聊天记录
  
  -->       
    <td width="100%"  class="menuitems"  onMouseover="highlightie5()"
    onMouseout="lowlightie5()"
    ondblclick="javascript:copyMessage(this)"
    
    style="cursor;hand"
    >       
    <font color=red>(<%=rs("msgdate")%>)  <%=rs("sender")%></font><br>
<%
omsg=changechr2(trim(rs("msg")))
Response.Write omsg
%><br>
      
</td>             
</tr>      
      <%
      rs.movenext
      
      loop
      rs.close
      Err.Clear
      %>  

</table>         
  <SCRIPT LANGUAGE=javascript>
<!--

//把选中的聊天记录复制到发消息框里去
function copyMessage(tr){
//parent.document.PostTopic.Message.value=tr.innerHTML
oldmsg=parent.document.PostTopic.Message.value
newmsg1=tr.innerText
if(oldmsg != "" ){
newmsg1=oldmsg+"\n"+newmsg1

}
parent.document.PostTopic.Message.value= newmsg1


}
//-->
</SCRIPT>

////////////
下面是发送消息页的主要代码:
<BODY   oncontextmenu=self.event.returnValue=false  bgColor=buttonface leftMargin=0 topMargin=0 LANGUAGE=javascript onunload="return window_onunload()" onload="return window_onload()" onresize="return window_onresize()">
<table width="100%" cellspacing="0" cellpadding="0" align=center>
<form action="messanger_post.asp" name=PostTopic  
  method=post>
  
  <tr bgcolor=buttonface>
      <td height="25" nowrap><b><font color="#003366">发送给: </font></b>
        <input readOnly size="10" value="<%=touser%>" style="BACKGROUND-COLOR: #d4d0c8;

BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid"
      name="touser"
     >
       <marquee  scrollamount=4  onmouseover="this.stop()" onmouseout="this.start()"> <b><font color="#cc0000"  >(按ALT+S或者CTRL+ENTER发送) </font></b></marquee></td>
        <td align="right" class="coolButton" onClick=‘’showModalDialog("userinfo.asp?theuser=<%=touser%>","","Help:no;Status:no;ScrollBar:no;DialogWidth:317px;DialogHeight:197px")‘’ height="25">
        <IMG alt=用户详细资料  border=0 src="face/<%=face%>" ></td>
                                                                                 
    <tr> <td vAlign="top"  colspan="2" align="middle"><table border="0" width="100%" cellspacing="0" cellpadding="0">                                              
        <tr>   <td width="100%"><TEXTAREA   <% if textline="回复消息" then %>   readonly <%end if%>  cols=44 name=Message onkeydown=presskey() rows=8 style="BORDER-BOTTOM: #ffffff 1px groove; BORDER-LEFT: #ffffff 1px groove; BORDER-RIGHT: #ffffff 1px groove; BORDER-TOP: #ffffff 1px groove; FONT-SIZE: 9pt; OVERFLOW: auto; WIDTH: 100%" wrap=hard><%=answer%></TEXTAREA></td>  </tr>   
      </table>                                                                            
      </td>                                                                              
    </tr>    
    
                                                                         
    <tr>                                                                            
      <td bgColor="#d4d0c8" colSpan="2" align="middle" height="27" width="766" >      
<input type="submit" value=<%=textline%>   name="B3" onclick=" return check(this.form)" accessKey="s">  
<input type="button" value="取消" name="B2" onclick="javascript:window.close()">   
<input type="reset" value="重写" name="B1">        
<input type="button" value="历史纪录" name="B1" onclick="javascript:ShowHideHistory()">  
      </td>                                                                                
    </tr>                                                                  
      </form>
   
</table>                                                  
<table border="0" cellspacing="0" cellpadding="0"  id="ChatHistory" width="100%" height="150">   
<tr>                                                                                
<td align="middle"><IFRAME
frameBorder=1 id=history name=history src="history.asp?touser=<%=touser%>" scrolling=yes width="100%" height="100%"
     ></IFRAME>                                                               
</td>                                                                               
</tr>                                                                              
</table>   
    <script  language=javascript>
    document.all[‘’ChatHistory‘’].style.display=‘’none‘’;
    window.resizeTo(370, 210);
    </script>
</BODY>               

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网