-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex1.html
178 lines (152 loc) · 6.04 KB
/
ex1.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html>
<head>
<script>
var obj = {
title: document.getElementById("title"),
logo: document.getElementById("logo"),
cover: document.querySelector("#cover"),
changeTitle: function () {
title.innerHTML = "<p id='name'>PES University</p>";
},
changeLogo: function () {
logo.src = "pes.png"
},
changeCover: function () {
cover.setAttribute("src", "pes_cover.jpg");
},
changePara: function () {
var paras = document.querySelectorAll(".desc")
for (var i = 0; i < paras.length; i++) {
paras[i].innerHTML = "We are PES University";
}
},
changeRed: function () {
var parent = document.getElementById("main");
parent.children[1].style.color = "red"
},
changeAll: function () {
this.changeCover();
this.changeLogo();
this.changePara();
this.changeRed();
this.changeTitle();
var btns = document.querySelectorAll(".change");
var btndiv = document.getElementById("btndiv");
for (var i = 0; i < btns.length; i++) {
btndiv.removeChild(btns[i]);
}
}
}
</script>
<style>
#logo{
z-index:1;
position:fixed;
top:10px;
left:10px;
}
#name{
font-family:impact;
font-size:3em;
text-align:center;
color:white;
}
#title{
z-index:1;
position:absolute;
top:10px;
left:200px;
}
body{
background-color:#AF7AC5;
}
.desc{
color:#4A235A;
font-family:garamond;
font-size:1.5em;
text-align:center;
}
#main{
border:4px grey solid;
background-color:#EBDEF0;
height:25%;
width:70%;
position:relative;
left:15%;
top:2%;
}
#houses{
align:center;
position:relative;
left:25%;
top:5%;
}
.house{
height:20em;
width:20em;
}
td{
border:1px solid black;
}
.al{
position:relative;
left:15%;
font-size:2em;
}
.change{
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(28, 184, 65); /* this is a green */
}
</style>
</head>
<body>
<img src="cover_hog.jpg" id="cover"/>
<img id="logo" src="h_logo.jpg"/>
<div id="title"><p id="name">HOGWART'S SCHOOL OF WITCHCRAFT & WIZARDRY</p></div>
<div id="main">
<p class="desc">
All first-years at Hogwarts must take seven subjects: Transfiguration, Charms, Potions, History of Magic, Defence Against the Dark Arts, Astronomy and Herbology. Flying lessons (on broomsticks) are also compulsory.
</p>
<p class="desc">
At the end of their second year at Hogwarts, students are required to choose a minimum of two more subjects from the following list: Arithmancy, Muggle Studies, Divination, Study of Ancient Runes and Care of Magical Creatures.
</p>
<p class="desc">Very specialised subjects such as Alchemy are sometimes offered in the final two years, if there is sufficient demand.</p>
</p>
</div>
<div id="houses">
<div><p class="al">HOUSES AT HOGWART'S</p></div>
<table>
<tr>
<td><img class="house" src="gryff.jpg"/></td>
<td><img class="house" src="raven.jpg"/></td>
</tr>
<tr>
<td><img class="house" src="huffle.jpg"/></td>
<td><img class="house" src="sly.jpg"/></td>
</tr>
</table>
<div id="btndiv">
<!--Change title to PES University -->
<input class="change" type="button" value="Change Title" onclick="obj.changeTitle()"/>
<!--Change to PES logo - GEBI-->
<input class="change" type="button" value="Change Logo" onclick="obj.changeLogo()"/>
<!--Change to PES logo - QS -->
<input class="change" type="button" value="Change Cover" onclick="obj.changeCover()"/>
<!--Change Paragraph 1,2,3 only - QSA-->
<input class="change" type="button" value="Change Para" onclick="obj.changePara()"/>
<!--Change Paragraph 2 to Red only-->
<input class="change" type="button" value="Change Red" onclick="obj.changeRed()"/>
<!--Change two houses to branches.Use traversal
<input class="change" type="button" value="Change Houses" onclick="obj.changeHouses()"/>-->
<!--Change everything and make the buttons disappear-->
<input class="change" type="button" value="Change Everything" onclick="obj.changeAll()"/>
<!-- Add a heading about events in PES
<input class="change" type="button" value="Add Heading" onclick="obj.addHeading()"/>
-->
</div>
</div>
</body>
</html>