-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (44 loc) · 1.22 KB
/
index.html
File metadata and controls
48 lines (44 loc) · 1.22 KB
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
<html>
<head>
<style>
#Q {
width: 300px; /* Adjust width as needed */
font-size: 24px; /* Adjust font size as needed */
text-align: center;
padding: 10px;
}
#A {
font-size: 24px; /* Adjust font size as needed */
text-align: center;
padding: 10px;
}
</style>
<script>
function Loop() {
setInterval(function() {
Calc();
}, 100); // Changed interval to 100 milliseconds for smoother response
}
function Calc() {
const inputValue = document.getElementById("Q").value; // Get the value from the input field
const result = calculate(inputValue); // Use a safer calculation function
document.getElementById("A").textContent = result;
}
function calculate(expression) {
// Implement a safe calculation function here
// Example:
try {
return Function('"use strict";return (' + expression + ')')();
} catch (error) {
return Q.value;
}
}
window.onload = Loop;
</script>
</head>
<body onload="Loop();">
<input id="Q" type="text">
<span id="A">Output</span>
<button onclick="window.open('https://duckduckgo.com/?q=frogs&t=opera&ia=images&iax=images', '_blank')">Frogs</button>
</body>
</html>