Advertisement
Guest User

Client

a guest
Jun 4th, 2013
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <html>
  2. <body>
  3. <script src="/socket.io/socket.io.js"></script>
  4. <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  5. <script>
  6. var socket = io.connect('http://localhost');
  7.  
  8. socket.on('connect', function () {
  9.  
  10. $('#button').click(function() {
  11.  
  12. var addtext = $('#text').val();
  13.  
  14. socket.emit('Text', addtext);
  15.  
  16.  
  17. });
  18.  
  19. socket.on('add', function(data) {
  20.  
  21. socket.broadcast.emit('AAA');
  22.  
  23. });
  24.  
  25. });
  26. </script>
  27. </script>
  28. <textarea id="aqui"></textarea><br />
  29. <input type="text" name="text" id="text"><input type="button" name="button" id="button" value="Enviar mensaje">
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement