add: var spanFrom = document.createElement("span"); spanFrom.className="from"; spanFrom.innerHTML=from+"&nbsp;"; var spanText = document.createElement("span"); spanText.className="text"; spanText.innerHTML=text; var lineBreak = document.createElement("br"); parentElement.appendChild(spanFrom); parentElement.appendChild(spanText); divChat.appendChild(lineBreak); divChat.scrollTop = divChat.scrollHeight - divChat.clientHeight; 
context:   _chat: function(message)  {     var chat=$('chat');     var from=message.getAttribute('from');     var special=message.getAttribute('alert');     var text=message.childNodes[0].data;     if ( special!='true' && from == room._last )         from="...";     else     {         room._last=from;         from+=":";     }          if(chat != null)     {         if (special=='true')           chat.innerHTML += "<span class=\"alert\"><span class=\"from\">"+from+"&nbsp;</span><span class=\"text\">"+text+"</span></span><br/>";         else           chat.innerHTML += "<span class=\"from\">"+from+"&nbsp;</span><span class=\"text\">"+text+"</span><br/>";         chat.scrollTop = chat.scrollHeight - chat.clientHeight;          }       },
meta: 9683	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9683/54adead4185dac9f216e2e85580f14e0448c967a/chat.js/buggy/tags/jetty-6.1.1rc0/examples/test-webapp/src/main/webapp/chat/chat.js