-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeDOM.html
More file actions
30 lines (30 loc) · 854 Bytes
/
Copy paththeDOM.html
File metadata and controls
30 lines (30 loc) · 854 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Planets</title>
<script>
function init() {
var planet = document.getElementById("greenplanet");
if (planet !=null)
{
planet.innerHTML = "Red Alert : hit by phaser fire!";
planet.setAttribute("class", "redtext");
}
}
//Here assigning the function init to the onload proporty
window.onload = init;
</script>
</head>
<style>
.redtext { color: red; }
</style>
<body>
<h1>Gree Planet</h1>
<p id="greenplanet"> All is well</p>
<h1>Red Planet</h1>
<p id="redplanet"> Nothing to report</p>
<h1>Blue Planet</h1>
<p id="blueplanet"> All systems A-OK</p>
</body>
</html>