/[projects]/miscJava/Test3/WebContent/WebsockTest.html
ViewVC logotype

Diff of /miscJava/Test3/WebContent/WebsockTest.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2112 by torben, Tue Feb 11 10:02:13 2014 UTC revision 2113 by torben, Tue Feb 11 12:44:13 2014 UTC
# Line 22  function append(str) { Line 22  function append(str) {
22  function sendMessage() {  function sendMessage() {
23          try {          try {
24                  var txt = $("#txt").val();                  var txt = $("#txt").val();
25                  append(txt);                  //append(txt);
26                                    
27                  socket.send(txt);                  socket.send( "CHAT#" + txt);
28                                    
29                  $("#txt").val("");                  $("#txt").val("");
30                  setActTime();                  setActTime();
# Line 69  $( function() { Line 69  $( function() {
69                  sendMessage();                  sendMessage();
70          });          });
71                    
72            $("#btnNick").click( function() {
73                    var nick = $("#nick").val();
74                    nick = $.trim(nick);
75                    
76                    try {
77                            socket.send( "NICK#" + nick);                  
78                    } catch(exception) {
79                            append(exception);
80                    }
81                    
82            });
83            
84          $(document).keypress(function(e) {          $(document).keypress(function(e) {
85                  if(e.which == 13) {                  if(e.which == 13) {
86                          sendMessage();                          sendMessage();
# Line 88  $( function() { Line 100  $( function() {
100  <textarea rows="30" cols="160" id="log" readonly></textarea>  <textarea rows="30" cols="160" id="log" readonly></textarea>
101  <br>  <br>
102  <input size=120  type="text" name="txt" id="txt">  <input size=120  type="text" name="txt" id="txt">
103  <button id="btn">Submit</button>  <button id="btn">Submit</button><br><br>
104    
105    <input size=20  type="text" name="nick" id="nick">
106    <button id="btnNick">Set Nick</button><br><br>
107    
108  <br><br>  <br><br>
109  <font size="2">  <font size="2">

Legend:
Removed from v.2112  
changed lines
  Added in v.2113

  ViewVC Help
Powered by ViewVC 1.1.20