-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (50 loc) · 1.89 KB
/
index.html
File metadata and controls
59 lines (50 loc) · 1.89 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
49
50
51
52
53
54
55
56
57
58
59
<!-- Display the countdown timer in an element -->
<h1 id="demo"></h1>
<img id="giftimer" src="./Pixel-animate_Boca.gif" width="600"></img>
<br>
<form id="formtohide" action="https://formspree.io/pesaher@gmail.com" method="POST" onsubmit="return myFunction()">
<input type="text" id="fname" size="20" name="fname">
<br>
<input type="submit" value="Try answer">
</form>
<script>
// Set the date we're counting down to
var countDownDate = new Date().getTime() + 7200000;
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the result in the element with id="demo"
document.getElementById("demo").innerHTML = hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is finished, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "0h 0m 0s";
document.getElementById("giftimer").src = "https://static-s.aa-cdn.net/img/amazon/30600000415955/b5755ff34df2f9a50087ff6cc8d6e71e";
document.getElementById("formtohide").style.display = "none";
}
}, 1000);
function myFunction() {
var fname = document.getElementById("fname").value;
submitOK = "false";
if (fname != "Bernanos Georges") {
//alert("The answer is not correct");
//submitOK = "false";
}
else
{
clearInterval(x);
document.getElementById("giftimer").src = "./Pixel-animate_finl.gif";
}
if (submitOK == "false") {
return false;
}
}
</script>