-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.htm
executable file
·79 lines (59 loc) · 2.24 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<title>Solver</title>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Charles Boyd"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="solver.js"></script>
<script>
solver.overrideEchoFunction(function(str){
console.log(str);
document.getElementById('output').innerHTML += str + '\n';
});
doEval = function(){
var ex = document.getElementById('input').value;
document.getElementById('output').innerHTML = solver.evaluate(ex);
};
doTT = function(){
var ex = document.getElementById('input').value;
document.getElementById('output').innerHTML = "";
solver.printTruthTable(ex);
};
doAuto = function(){
var ex = document.getElementById('input').value;
document.getElementById('output').innerHTML = "";
solver.auto(ex);
};
clearPage = function(){
document.getElementById('input').value="";
document.getElementById('output').innerHTML = "";
};
</script>
</head>
<body style="font-family: sans-serif;">
<p>Enter an equation or a logical expression. <a href="readme.txt">Help/Details/Info</a></p>
<input id="input" name="input" type="text" value="" style="width: 96%;margin:1%;height:1.6em;"/>
<br/>
<br/>
<button onclick="doEval();">Evaluate</button>
<button onclick="doTT();">Print Truth Table</button>
<button onclick="clearPage();">Clear</button>
<br/>
<hr/>
<p id="output" style="white-space: pre; font-family: monospace;"></p>
<script>
//Bind to the return/enter key
document.getElementById("input").addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode == 13) {
doAuto();
}
});
//Default for page load
document.getElementById('input').value = 'A | (1 & B)';
doAuto();
</script>
</body>
</html>