/[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 2114 by torben, Tue Feb 11 12:49:11 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);                  txt = $.trim(txt);
26                    //append(txt);
27                    if (txt == "")
28                            return;
29                                    
30                  socket.send(txt);                  socket.send( "CHAT#" + txt);
31                                    
32                  $("#txt").val("");                  $("#txt").val("");
33                  setActTime();                  setActTime();
# Line 69  $( function() { Line 72  $( function() {
72                  sendMessage();                  sendMessage();
73          });          });
74                    
75            $("#btnNick").click( function() {
76                    var nick = $("#nick").val();
77                    nick = $.trim(nick);
78                    
79                    if (nick == "") {
80                            alert("Nick can not be empty");
81                            return;
82                    }
83                    
84                    try {
85                            socket.send( "NICK#" + nick);                  
86                    } catch(exception) {
87                            append(exception);
88                    }
89                    
90            });
91            
92          $(document).keypress(function(e) {          $(document).keypress(function(e) {
93                  if(e.which == 13) {                  if(e.which == 13) {
94                          sendMessage();                          sendMessage();
# Line 88  $( function() { Line 108  $( function() {
108  <textarea rows="30" cols="160" id="log" readonly></textarea>  <textarea rows="30" cols="160" id="log" readonly></textarea>
109  <br>  <br>
110  <input size=120  type="text" name="txt" id="txt">  <input size=120  type="text" name="txt" id="txt">
111  <button id="btn">Submit</button>  <button id="btn">Submit</button><br><br>
112    
113    <input size=20  type="text" name="nick" id="nick">
114    <button id="btnNick">Set Nick</button><br><br>
115    
116  <br><br>  <br><br>
117  <font size="2">  <font size="2">

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

  ViewVC Help
Powered by ViewVC 1.1.20