forked from isabellatea/FunWithDOMEvents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
32 lines (25 loc) · 842 Bytes
/
script.js
File metadata and controls
32 lines (25 loc) · 842 Bytes
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
let button = document.getElementById('play-button');
let text= document.getElementById('challenge-one');
let body = document.getElementsByTagName('BODY')[0];
let title = document.getElementById('page-title');
text.addEventListener("dblclick", whenDuoClicked);
button.addEventListener("click", whenClicked);
button.addEventListener("mouseover", whenHovered);
title.addEventListener("copy", whenCopied)
body.addEventListener("contextmenu",whenRightClicked)
function whenClicked() {
button.style.top = Math.random() *100 + '%';
button.style.left = Math.random() *100 + '%';
}
function whenDuoClicked() {
body.removeChild(text)
}
function whenHovered() {
button.style.backgroundColor = "red";
}
function whenCopied() {
alert("Don't cantch up rall");
}
function whenRightClicked(){
body.backgroundImage = ('images/pokemonBG2.png');
}