Skip to content

Commit 33eeba0

Browse files
committed
function, arrow function & onclick function 🔒
1 parent a628bd1 commit 33eeba0

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

CSS/style.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body{
2+
background-color: black;
3+
color: white;
4+
}
5+
6+
.top{
7+
text-align: center;
8+
margin: 10px;
9+
}
10+
11+
#title{
12+
text-align: center;
13+
}

index.html

+36
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,45 @@
44
<meta charset="UTF-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
8+
<!-- Boostrap CSS -->
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
10+
11+
<!-- Custome CSS -->
12+
<link rel="stylesheet" href="./CSS/style.css">
713
<title>JS Practice</title>
814
</head>
915
<body>
16+
17+
<h1 class="top">Java-Script Practice</h1>
18+
19+
<br>
20+
21+
<h2 id="heading"></h2>
22+
23+
<br>
1024

25+
<h3 id="write"></h3>
26+
27+
<br>
28+
29+
<!-- Function -->
30+
31+
<button id="plus" type="button" class="btn btn-danger" onclick="sum()">Click me</button>
32+
33+
<br>
34+
35+
<h3 id="title"></h3>
36+
<button type="button" class="btn btn-danger" onclick="display()">Display</button>
37+
<button type="button" class="btn btn-danger" onclick="back()">Back</button>
38+
39+
40+
41+
<!-- Boostrap JS -->
42+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
43+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
44+
45+
<!-- Custome JS -->
46+
<script src="./js/script.js"></script>
1147
</body>
1248
</html>

js/script.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// intro
2+
3+
document.getElementById("heading").innerHTML="Hello Zahid";
4+
document.getElementById("heading").style.color="red";
5+
document.getElementById("heading").style.backgroundColor="yellow";
6+
7+
// Write Method
8+
9+
document.write("Thank you for comming Here");
10+
11+
// Alert Method
12+
13+
window.alert("Do you really want to see this ??");
14+
15+
// Functiion
16+
17+
// sum
18+
const sum = ()=>{
19+
var a = 7.5;
20+
var b = 5;
21+
var c = a + b;
22+
console.log("The value of a+b is: " ,c);
23+
};
24+
25+
// arrow function
26+
const display = ()=>(
27+
document.getElementById("title").innerHTML="Yo Hoo!"
28+
);
29+
30+
const back = ()=>(
31+
document.getElementById("title").style.display="none"
32+
);

0 commit comments

Comments
 (0)