日期:2014-05-19  浏览次数:20490 次

帮帮忙吧各位高手,来看看什么问题
聊天室分屏
已经实现分屏功能,但内容显示不到分屏的那个上面
分屏采用的是div层用两个div层,点击选中分屏,则第二个div层显示出来
这个做到了,关键是现在分屏的那个层不能显示内容阿,每次自己发内容只在上面显示,下面的不显示。而如果用另外的客户端发来,则自己的客户端另外一个div层就会把原来没有显示的一起显示上去,而且对方发来的消息还重复一遍,如果对方再发来消息,还会把上面重复的覆盖,然后继续这一句话重复一遍
代码如下
//发送消息
    function   send()
    {
      var   txtContent   =   document.all( "content ").value;   //文本框输入内容
      if   (txtContent   ==   " ")   return;
     
      var   user_to   =   document.all( "userlist ").value;     //聊天对象
      var   textcolor   =   document.all( "textcolor ").value;     //颜色
      var   expression   =   document.all( "expression ").value;     //表情
      var   isPublic   =   !(document.all( "isSecret ").checked);     //是否密谈        
     
      //调用服务器端方法发送消息
      Chat.ChatRoom.SendMsg(txtContent,   user_to,   textcolor,   expression,   isPublic);
     
      //更新聊天内容显示
      var   div   =   document.all( "chatcontent ");
     
      var   isLeft   =   !(document.all( "isLeft ").checked);
      div.innerHTML   =   div.innerHTML+Chat.ChatRoom.GetNewMsgString().value;
      if(!isLeft)//如果分屏被选中
      {
        var   div1   =document.all( "chat1 ");
        div1.innerHTML=div1.innerHTML+Chat.ChatRoom.GetNewMsgString().value;
      }
      //清空输入框
      document.all( "content ").value   =   " ";
    }
   
    //定时更新聊天内容
    function   refresh_chatcontent()
    {
      //调用服务器方法获取最新消息的HTML字符串
      var   div   =   document.all( "chatcontent ");
      var   strNewMsg   =Chat.ChatRoom.GetNewMsgString().value;
      var   isLeft   =   !(document.all( "isLeft ").checked);
     
      //判断是否为空,避免不必要的更新
      if   (strNewMsg   !=   " ")
      {
        div.innerHTML   =div.innerHTML+strNewMsg;
        if(!isLeft)
      {
          var   div1   =document.all( "chat1 ");
          div1.innerHTML=div.innerHTML+strNewMsg;
        }
      }
       
      //定时更新
      window.setTimeout(refresh_chatcontent,   1000);
    }
    //是否分屏
    function   isCleft()
    {
var   isLeft   =   !(document.all( "isLeft ").checked);     //是否分屏
var   div   =   document.all( "chatcontent ");
        var