-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
125 lines (120 loc) · 3.03 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<html>
<head>
<meta charset="UTF-8">
<title>RaspberryPi Hexapod</title>
<script type="text/javascript">
function button(value) {
if(value=='manual'){
document.getElementById('forward').disabled=false;
document.getElementById('backward').disabled=false;
document.getElementById('left').disabled=false;
document.getElementById('right').disabled=false;
document.getElementById('stop').disabled=false;
}else if(value=='auto'){
document.getElementById('forward').disabled=true;
document.getElementById('backward').disabled=true;
document.getElementById('left').disabled=true;
document.getElementById('right').disabled=true;
document.getElementById('stop').disabled=true;
}
var request = false;
if(window.XMLHttpRequest){
request = new XMLHttpRequest();
}else if(window.ActiveXObject){
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
request = new ActiveXObject("Msxml.XMLHTTP");
}
}
//XMLHttpRequest failed
if(!request){
alert("XMLHttpRequest failed...");
return false;
}
//query
var send = 'code=' + value;
request.open('POST','/hexapod/hexapod.php',true);
//HTML header
request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
request.send(send);
}
</script>
<style>
.button {
height:100px;
width: 80px;
border: 0;
}
#left{
background: url(assets/Go%20Right.png) no-repeat;
position: relative;
left: -150px;
top: 80px;
}
#left:hover{
background: url(assets/GO%20right_action.png) no-repeat;
}
#right{
background: url(assets/GO-left.png) no-repeat;
position: relative;
left: 250px;
top: 80px;
}
#right:hover{
background: url(assets/GO%20left%20Action.png) no-repeat;
}
#forward{
background: url(assets/Forward.png) no-repeat;
position: relative;
left: 91px;
top: 6px;
}
#forward:hover{
background: url(assets/Forward_Action.png) no-repeat;
}
#backward{
background: url(assets/Backward.png) no-repeat;
position: relative;
left: 8px;
top: 155px;
}
#backward:hover{
background: url(assets/Backward_action.png) no-repeat;
}
#stop{
background: url(assets/STOP.png) no-repeat;
position: relative;
left: -160px;
top: 80px;
}
#auto{
background-color: 34495e;
color: #ffffff;
}
#manual{
background-color: 3598db;
color: #ffffff;
}
</style>
</head>
<body>
<center>
<br>
<br>
<img src="assets/Logo.png"></img>
<br>
<br>
<input id="auto" class="button" type="button" value="Auto" onClick="button('auto')">
<input id="manual" class="button" type="button" value="Manual" onClick="button('manual')">
<br>
<br>
<br>
<input id="right" class="button" disabled="true" type="button" value="" onClick="button('right')">
<input id="forward" class="button" disabled="true" type="button" value="" onClick="button('front');">
<input id="backward" class="button" disabled="true" type="button" value="" onClick="button('back');">
<input id="left" class="button" disabled="true" type="button" value="" onClick="button('left');">
<input id="stop" class="button" disabled="true" type="button" value="" onClick="button('stop');">
</center>
</body>
</html>