-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterctivity events.html
85 lines (79 loc) · 2.15 KB
/
interctivity events.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!--<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script>
document.getElementById('output').innerHTML=msg+"event";
function message(x){
alert(x);
}
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
<style>
div{
cursor: pointer;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body onload="message('LOAD')" onresize="message('RESIZE')">
<div onclick="message('hi')">click here</div>
<p id="output"></p>
<p id="demo">this is a paragraph</p>
<button type="button"
onclick="displayDate()">Display date</button>
</body>
</html>-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.closed{
display:none;
}
.open
{
display:block;
}
#demo{
padding:1%;
margin:5%;
background-color: grey;
}
</style>
</head>
<body>
<button type="button" onclick="openme()">open</button>
<button type="button" onclick="closeme()">close</button>
<p id="demo">hurray!congratulations for the promotion</p>
<script>
function closeme(){
// Find the element
x=document.getElementById("demo");
//Option 1: Change the style attribute directly
x.style.display="none";
//Option 2: Change the class
// x.className="closed";
}
function openme(){
// Find the element
x=document.getElementById("demo");
//Option 1: Change the style attribute directly
x.style.display="block";
//Option 2: Change the class
// x.className="open";
}
</script>
<!--<h1>Events</h1>
<button onclick="document.getElementById('stuff').innerHTML='first button clicked';">First</button>
<button onclick="document.getElementById('stuff').innerHTML='second button clicked';">second</button>
<div id="stuff">This will change</div>-->
</body>
</html>