-
Notifications
You must be signed in to change notification settings - Fork 0
/
Truth Tables.html
149 lines (141 loc) · 3.79 KB
/
Truth Tables.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<style>
table, td {
border: 1px solid black;
font-style: italic;
text-align: center;
}
th {
border: 2px solid black;
text-align: center;
}
table {
width: 540px;
table-layout: fixed;
margin-top: 20px;
}
td {width: 90px}
div {
color: #009933;
margin: auto;
}
input {
type: text;
width: 75px;
}
</style>
<body>
<form name="info">
<table align="center">
<tr>
<th>p</th><th>~p</th><th>q</th>
<th>r</th><th>q∧r</th><th>~p∨(q∧r)</th>
</tr>
<tr>
<td>T</td><td>F</td><td>T</td>
<td>T</td><td>T</td><td>T</td>
</tr>
<tr>
<td>T</td><td>F</td><td>T</td>
<td>F</td><td>F</td><td>F</td>
</tr>
<tr>
<td>T</td><td>F</td>
<td><input name="ip1"></td>
<td>T</td><td>F</td>
<td><input name="ip2"></td>
</tr>
<tr>
<td>T</td><td>F</td><td>F</td>
<td>F</td><td>F</td><td>F</td>
</tr>
<tr>
<td>F</td><td>T</td><td>T</td>
<td><input name="ip3"></td>
<td>T</td><td>T</td>
</tr>
<tr>
<td>F</td>
<td><input name="ip4"></td>
<td>T</td>
<td>F</td><td>F</td><td>T</td>
</tr>
<tr>
<td>F</td>
<td>T</td>
<td><input name="ip5"></td>
<td>T</td><td>F</td><td>T</td>
</tr>
<tr>
<td>F</td><td>T</td><td>F</td>
<td>F</td>
<td><input name="ip6"></td>
<td>T</td>
</tr>
</table>
</form>
<script>
function makeLog(){
var holder = document.createElement('div');
holder.style.fontFamily = 'monospace';
holder.style.fontSize = '14';
holder.style.height = '300px';
holder.style.width = '400px';
holder.style.overflow = 'auto';
holder.style.border = '1px solid #666';
holder.style.backgroundColor = '#000';
holder.style.padding = '8px';
holder.style.marginTop = '20px';
holder.style.marginBottom = '20px';
document.body.appendChild(holder);
return holder;
}
var terminal = makeLog();
var correct = false;
function logMessage(text,log){
var message = document.createElement('div');
message.textContent = text;
log.appendChild(message);
}
logMessage('New Login: ' + new Date(Date.parse('2000-1-1 03:14:15')), terminal)
logMessage(' ', terminal)
function checkInput(){
if (!correct) {
correct = true;
if (document.info.ip1.value != 'F' && document.info.ip1.value != 'f'){
logMessage('Incorrect Input Received (3, 3).', terminal);
correct = false;
}
if (document.info.ip2.value != 'F' && document.info.ip2.value != 'f'){
logMessage('Incorrect Input Received (6, 3).', terminal);
correct = false;
}
if (document.info.ip3.value != 'T' && document.info.ip3.value != 't'){
logMessage('Incorrect Input Received (4, 5).', terminal);
correct = false;
}
if (document.info.ip4.value != 'T' && document.info.ip4.value != 't'){
logMessage('Incorrect Input Received (2, 6).', terminal);
correct = false;
}
if (document.info.ip5.value != 'F' && document.info.ip5.value != 'f'){
logMessage('Incorrect Input Received (3, 7).', terminal);
correct = false;
}
if (document.info.ip6.value != 'F' && document.info.ip6.value != 'f'){
logMessage('Incorrect Input Received (5, 8).', terminal);
correct = false;
}
if (correct) {
logMessage('Correct Input Received. (F F T T F F)', terminal);
logMessage('PC Access Code: .)n;+HHy%-Wt86wt', terminal);
}
}
}
document.addEventListener('keydown', function(event){
if (event.keyCode == 13) checkInput();
});
</script>
</body>
</html>