-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotrickroll.html
64 lines (41 loc) · 1.82 KB
/
notrickroll.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
<!DOCTYPE HTML>
<html>
<title>Shluffy.github.io - Not Rickroll</title>
<head>
<link rel = "stylesheet" type="text/css" href="assets/css/stylesheet.css">
</head>
<div id="hiddentext">
</div>
<p id="btn">
<button onclick="message()">Click Me to Reveal The Secret Message</button>
</p>
<script>
//The value of the variable below is the message
var message1 = "You have found the secret message. This uses a random pick to decide which one you get, so click the button to hide this message and then click it again to get another message.";
//Or if you get lucky this will display a rickroll for you
var rickroll = '<iframe width="538" height="324" src="//www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&mute=1"></iframe> <br> Click the button to hide this and then click it again to pssoibly get a different message.';
//Variables for the different components of the function (one of these must be global and one is easier to have as a global variable
var m = document.getElementById("hiddentext");
var shown = false;
var p = document.getElementById("btn");
//function to reveal message
function message() {
if (shown == false){
var message = Math.floor(Math.random()*2);
if (message == 1){
m.innerHTML = message1;
}
else if (message == 2){
m.innerHTML = rickroll;
}
shown = true;
p.innerHTML = '<button onclick="message()">Hide the message</button>';
}
else if (shown == true){
m.innerHTML = null;
shown = false;
p.innerHTML = '<button onclick="message()">Click Me to Reveal The Secret Message</button>';
}
}
</script>
</html>