Created
June 7, 2015 06:51
-
-
Save calderonroberto/b3d4dade3aaae83a7383 to your computer and use it in GitHub Desktop.
Example RED Application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="en"> | |
<head> | |
<title>Chat</title> | |
<script type="text/javascript" src="jquery-1.7.2.min.js"></script> | |
<script type="text/javascript" src="jquery.thingbroker-0.3.0.min.js"></script> | |
<style type="text/css"> | |
p {color:gray;font-size:16px; font-style:bold; width:100px; height:100px; background-color:#E9E74A; float:left; margin-left:5px; margin-top:5px;padding:4px} | |
</style> | |
</head> | |
<body> | |
<input type="text" id="txtbox" /> | |
<div id="chat"><p>Welcome to the discussion app.</p></div> | |
<script type="text/javascript"> | |
$("#chat").thing({listen:true}); | |
$("#txtbox").keypress(function(e){ | |
if (e.which == 13) { | |
$(this).thing({prepend:"<p>"+$(this).val()+"</p>", to: 'chat'}); | |
$(this).val(""); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment