Skip to content

Commit 0c90784

Browse files
author
Redwan Sharafat Kabir
committed
1 parent 429604f commit 0c90784

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

Basic JS and HTML/Sort.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>JavaScript Class - 04</title>
5+
</head>
6+
<body>
7+
<div align="center">
8+
<h1>JavaScript Class - 04</h1>
9+
</div>
10+
11+
<script>
12+
let users = [1,2,5,6,41,0]
13+
14+
function Sorting(a,b){
15+
return a> b ? 1 : -1
16+
}
17+
let sorted = users.sort(Sorting)
18+
document.write(sorted);
19+
</script>
20+
</body>
21+
</html>

Basic JS and HTML/eventListener.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>mastering js class - 05</title>
5+
</head>
6+
<body>
7+
<ul id="content">
8+
<li>Hello world !</li>
9+
<li>Good bye world.</li>
10+
</ul>
11+
12+
<button id="button">Sign in</button>
13+
14+
<input type="text" id="myText">
15+
<button onclick="btnFunction()">Enter</button>
16+
<h4 id="output"></h4>
17+
18+
<script>
19+
let list = document.querySelector("#content");
20+
list.insertAdjacentHTML("beforeend", "<li>I'm sad</li>");
21+
list.insertAdjacentHTML("beforeend", "<li>I'm broken</li><br><br>");
22+
23+
let tasks = [
24+
"Shukahash",
25+
"Discount",
26+
"Kabila"
27+
]
28+
29+
tasks.forEach(function(task){
30+
list.insertAdjacentHTML("beforeend", `<li>${task}</li>`)
31+
})
32+
33+
let btn = document.querySelector("#button");
34+
btn.addEventListener("click", function(){
35+
//let item = prompt("New task");
36+
//list.insertAdjacentHTML("beforeend",`<li>${item}</li>`);
37+
})
38+
function btnFunction() {
39+
var btn2 = document.getElementById("myText").value;
40+
document.getElementById("output").innerHTML = btn2;
41+
}
42+
</script>
43+
</body>
44+
</html>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>mastering js class - 05</title>
5+
</head>
6+
<body>
7+
<ul id="content">
8+
<li>Hello world !</li>
9+
<li>Good bye world.</li>
10+
</ul>
11+
12+
<script>
13+
let list = document.querySelector("#content");
14+
list.insertAdjacentHTML("beforeend", "<li>I'm sad</li>");
15+
list.insertAdjacentHTML("beforeend", "<li>I'm broken</li><br><br>");
16+
17+
let tasks = [
18+
"Shukahash",
19+
"Discount",
20+
"Kabila"
21+
]
22+
23+
tasks.forEach(function(task){
24+
list.insertAdjacentHTML("beforeend", `<li>${task}</li>`)
25+
})
26+
</script>
27+
</body>
28+
</html>

Basic JS and HTML/querySelector.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>mastering js class - 05</title>
5+
</head>
6+
<body>
7+
8+
<h1 id="header1"> Hello world !</h1>
9+
<!--<h2 class="header2 header3">Good bye world.</h2>-->
10+
<!--<h3 class="header2">I'm sad.</h3>-->
11+
<!--<p class="header3">Don's disturb me.</p>-->
12+
13+
<script>
14+
//let node1 = document.write(header1);
15+
//let node2 = document.write(header2);
16+
//let node3 = document.write(header3);
17+
//let node4 = document.write(header3);
18+
19+
let id1 = document.querySelector(header1);
20+
//let class3 = document.querySelector(".header2");
21+
22+
let node5 = id1.innerText;
23+
console.log(node5) // Hello world !
24+
id1.innerText = "I'm broken."
25+
</script>
26+
</body>
27+
</html>

0 commit comments

Comments
 (0)