corrade-http-templates
/groupChat/groupChat.html |
@@ -39,14 +39,15 @@ |
}); |
} |
// Polls the chatlog every second for changes. |
setInterval(function () { |
(function retrieveMessages() { |
$.get("chat.log?t=" + Math.random(), function(data) { |
$("#chat").html(data); |
$("#chat").animate({ |
scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
},1000); |
setTimeout(retrieveMessages, 1000); |
}); |
$("#chat").animate({ |
scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
},1000); |
}, 1000); |
}()); |
// When the send button is pressed, then call the sendGroupMessage function to |
// send the message to the PHP script, which then send the message to Corrade. |
$("#send").click(function(e){ |
@@ -65,7 +66,7 @@ |
|
<body> |
<div id="container"> |
<textarea id="chat" rows="12"></textarea><br/> |
<textarea readonly='readonly' id="chat" rows="12"></textarea><br/> |
<div id="controls"> |
Name: <input type="text" size="8" value="Someone" id="name"></input> |
Message: <input type="text" size="35" id="message"></input> |