Skip to content

Instantly share code, notes, and snippets.

@kamito
Created January 23, 2011 14:09
Show Gist options
  • Save kamito/792103 to your computer and use it in GitHub Desktop.
Save kamito/792103 to your computer and use it in GitHub Desktop.
socket.onmessage = function(response) {
var data = response.data;
var name_txt = data.user + " : ";
var message_txt = data.message + " (" + data.updated_at + ")";
var tbody = goog.dom.getElement("messages");
var th_name = goog.dom.createDom("th", {style:"text-align:right;"}, name_txt);
var td_message = goog.dom.createDom("td", {}, message_txt);
var tr = goog.dom.createDom("tr", {}, [th_name, td_message]);
tbody.insertBefore(tr, tbody.childNodes[0]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment