forked from streets-ahead/couchdb-websockets
/
index.htm
61 lines (54 loc) · 1019 Bytes
/
index.htm
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>couch test</title>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('update', function (data) {
var d = JSON.parse(data);
if(d.myField) {
var p = document.createElement('p');
var cont = document.createTextNode(d.myField);
p.appendChild(cont);
var inner = document.getElementById('innerBox');
inner.appendChild(p);
}
});
</script>
<style type="text/css" media="screen">
* {
margin:0px;
padding:0px;
}
body {
font-family: Verdana, sans-serif;
}
#box {
width:500px;
height:400px;
border:1px solid #666;
position:relative;
top:50px;
left:50%;
margin:0px 0px 0px -250px;
overflow:scroll;
}
#innerBox {
position:absolute;
bottom:0px;
width:100%;
}
p {
padding:10px 10px;
}
</style>
</head>
<body>
<div id="box">
<div id="innerBox">
</div>
</div>
</body>
</html>