-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass14.html
More file actions
58 lines (55 loc) · 1.81 KB
/
class14.html
File metadata and controls
58 lines (55 loc) · 1.81 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
#mydiv{
width:200px;
height: 200px;
border-radius: 20px;
background-color: blueviolet;
}
</style>
</head>
<body>
<div align="center">
<h2 class="data">Check details</h2>
<h3>Visit again</h3>
<!-- Dom Event:action that takes place as a result of change in the dom tree -->
<h1 id="greet">Hello</h1>
<button ondbclick="id1()">Click Here</button><br><br>
<div id="mydiv"><br>
<button onclick="bg()">Change background</button>
</div>
</div>
<script>
// innerHTML:helps change modify html
//use index number for priority
document.getElementsByClassName("data")[0].innerHTML="Verify the data"
document.getElementsByTagName("h3")[0].innerHTML="Thank You"
function id1()
{
document.getElementById("greet").innerHTML="This is modified by DOM selectors "
}
// generating bg color
//bg generator
function bg()
{
var r=Math.floor(Math.random()*255)
var g=Math.floor(Math.random()*255)
var b=Math.floor(Math.random()*255)
var change="rgb("+r+","+g+","+b+")"
console.log(change)
document.querySelector("#mydiv").style.background=change;
document.body.style.background=change
}
</script>
<!-- Node.js: is based on scripting language.
Open source server side environment.learn js free of cost.
platform independent
ASP.net-->
</body>
</html>