-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
48 lines (46 loc) · 1.16 KB
/
test.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#box{
width: 250px;
height: 250px;
background: yellow;
}
</style>
</head>
<body>
<input type="text" id="input">
<input type="text" id="input2">
<button id="button">Go</button>
<script>
changeRed = function(){
console.log("Change Red on click");
var box = document.getElementById("input");
box.style.background = "red";
}
changeGreen = function(){
console.log("Change Green on mouseover");
var box = document.getElementById("input");
box.style.background = "green";
}
changePurple = function(){
console.log("Change Purple on blur");
var box = document.getElementById("input");
box.style.background = "purple";
}
changeWhite = function(){
console.log("Change Purple on blur");
var box = document.getElementById("input");
box.style.background = "white";
}
var button = document.getElementById("input");
//button.addEventListener("click", changeRed);
//button.addEventListener("mouseover", changeGreen);
button.onblur = changePurple;
button.onfocus = changeWhite;
</script>
</body>
</html>