-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
54 lines (51 loc) · 1.69 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
45
46
47
48
49
50
51
52
53
54
<html>
<body>
<script>
var cams = ["wc2", "wc1"];
for(var id in cams) {
var mainDiv = document.createElement('div');
mainDiv.style.float = "left";
mainDiv.style.border = "solid black 1px";
var img = new Image();
img.src = "webcamProxy.php/?webcam="+cams[id]+"&cmd=mjpeg";
mainDiv.appendChild(img);
mainDiv.appendChild(document.createElement('br'));
var up = document.createElement('a');
up.innerHTML = "Up";
up.href = "javascript:void(0)";
up.setAttribute("onclick","wc1_move('"+cams[id]+"', 'Up')");
mainDiv.appendChild(up);
mainDiv.appendChild(document.createElement('br'));
var left = document.createElement('a');
left.innerHTML = "Left";
left.href = "javascript:void(0)";
left.setAttribute("onclick","wc1_move('"+cams[id]+"', 'Left')");
mainDiv.appendChild(left);
mainDiv.appendChild(document.createElement('br'));
var right = document.createElement('a');
right.innerHTML = "Right";
right.href = "javascript:void(0)";
right.setAttribute("onclick","wc1_move('"+cams[id]+"', 'Right')");
mainDiv.appendChild(right);
mainDiv.appendChild(document.createElement('br'));
var down = document.createElement('a');
down.innerHTML = "Down";
down.href = "javascript:void(0)";
down.setAttribute("onclick","wc1_move('"+cams[id]+"', 'Down')");
mainDiv.appendChild(down);
document.body.appendChild(mainDiv);
}
function wc1_move(wc, d) {
var oReq = new XMLHttpRequest();
oReq.open('GET', 'webcamProxy.php?webcam='+wc+'&cmd=move'+d, true);
oReq.send();
window.setTimeout(wc1_stop, 1000, wc, d);
}
function wc1_stop(wc, d) {
var oReq = new XMLHttpRequest();
oReq.open('GET', 'webcamProxy.php?webcam='+wc+'&cmd=stop'+d, true);
oReq.send();
}
</script>
</body>
</html>