Skip to content

Commit a585d37

Browse files
committed
config dom2
1 parent b8883dd commit a585d37

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

js_basics/dom/d2.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>DOM Learning</title>
7+
<style>
8+
.bg-black{
9+
background-color: #212121;
10+
color:white;
11+
}
12+
</style>
13+
</head>
14+
<body class="bg-black">
15+
16+
</body>
17+
<script>
18+
const div = document.createElement('div');
19+
div.className = "main";
20+
div.id = Math.round(Math.random()*10+1)
21+
div.setAttribute("title","generated title");
22+
div.style.backgroundColor = "orange"
23+
// div.innerHTML = "Hello Krish";
24+
const addText = document.createTextNode("chai aur code");
25+
div.appendChild(addText);
26+
document.body.appendChild(div);
27+
</script>
28+
</html>

0 commit comments

Comments
 (0)