Repository navigation
Expand file tree
/
Copy path02_Inline.html
More file actions
68 lines (57 loc) · 1.68 KB
/
Copy path02_Inline.html
File metadata and controls
68 lines (57 loc) · 1.68 KB
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Inline JavaScript</title>
<style>
body{
margin: 0;
font-family: "Comic Sans MS",sans-serif;
}
h2{
background-color: lightgreen;
text-align: center;
padding: 10px;
}
#text-div{
background-color: seagreen;
padding: 10px;
text-align: center;
color: white;
margin-bottom: 10px;
}
#image-div{
background-color: seagreen;
padding: 10px;
text-align: center;
color: white;
margin-bottom: 10px;
}
#green-p{
font-size: 25px;
}
</style>
</head>
<body>
<h2>Inline JavaScript Example</h2>
<div>
<h1 id="display"></h1>
</div>
<!-- Change the below Text using Inline JavaScript -->
<div id="text-div">
<p id="green-p">Change my Color using the below Buttons</p>
<button onclick="document.getElementById('green-p').style.color='blue'">Change to Blue</button>
<button onclick="document.getElementById('green-p').style.color='red'">Change to Red</button>
</div>
<!-- Change the below Image using Inline JavaScript -->
<div id="image-div">
<img src="../img/google.jpg" width="300" height="200" id="myImage">
<br>
<button onclick="document.getElementById('myImage').setAttribute('src','../img/facebook.jpg')">Facebook</button>
<button onclick="document.getElementById('myImage').setAttribute('src','../img/youtube.jpg')">Youtube</button>
</div>
<!-- Add your Java Script code here for Inline Way-->
<script>
</script>
</body>
</html>