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

80酷酷网    80kuku.com

  接上-----“模拟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)"
    
     color=red>(<%=rs("msgdate")%>)  <%=rs("sender")%></font>

<%
omsg=changechr2(trim(rs("msg")))
Response.Write omsg
%>

      
</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 var webSiteID = 6;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%>" #d4d0c8;

BORDER-BOTTOM-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-STYLE: solid; BORDER-TOP-STYLE: solid"
      name="touser"
     >
       <marquee  scrollamount=4  

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: