-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
44 lines (40 loc) · 1.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8090');
</script>
<script type="text/javascript" src="js/jquery.gracefulwebsocket.js"></script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript">
$ = jQuery.noConflict();
$(document).ready(function(){
for(var i=0;i<10;i++){
var $input = $("<input>")
.attr('level', i)
.attr('type', 'button')
.bind('click', function(){
var level = $(this).attr('level');
socket.emit('message', level);
console.log('sent '+level);
})
.appendTo('body');
}
socket.on('message', function(message){
console.log(message);
$('.duh').append(message);
});
});
</script>
</head>
<body>
<div class="duh"></div>
</body>
</html>