Repository navigation
Expand file tree
/
Copy pathfunction_and_DOM.html
More file actions
91 lines (77 loc) · 2.31 KB
/
Copy pathfunction_and_DOM.html
File metadata and controls
91 lines (77 loc) · 2.31 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<head>
<title>DOM Functions</title>
<h1> DOM FUNCTIONS</h1>
</head>
<body>
<script type="text/javascript">
/*
const giveTheFactorial =(val) =>{
if(val<1) return 0;
if(val == 1) return 1;
//let retVal = 1;
let retVal = 1;
for(letj=1;j<=val;j++){
retVal *= j;
}
return retVal;
};
document.write(giveTheFactorial(5));
*/
/*
var arr=["a","b","c","d"];
arr.push("e");
arr.push("f");
arr.push("g");
for(let i=0;i<arr.length;i++){ document.write("<h2>"+arr[i]+"</h2>");}
arr.pop();
arr.pop();
for(let i=0;i<arr.length;i++) { document.write("<h2>"+arr[i]+"</h2>");}
//document.write("<h2>"+arr[i]+"</h2>");
*/
// let obj = new object();
// obj.name = "aman";
// obj.kam = "labour";
// obj.ghar = "beghar";
// obj.izzat = "lut gayi";
// document.write(obj.name);
// document.write(obj.kam);
// document.write(obj.ghar);
// document.write(obj.izzat);
//above object is not working
/*
let obj1 = {
jhar : "khand ",
bi : "har ",
uttar: "pradesh",
dar: function(){
return " bhoot se";
}
};
document.write(obj1.jhar);
document.write(obj1.bi);
document.write(obj1.uttar);
document.write(obj1.dar);
*/
// function bnclk1(){
// //document - represent the global dom object
// var str = document.getElementById("heading1").innerHTML="hello aman";
// //alrt(str);
// }
// function bnclk2(){
// //document - represent the global dom object
// var str = document.getElementById("heading2").innerHTML=" good bye aman";
// //alrt(str);
// }
function alrtMessage(){
alert('hey you have click it!');
}
</script>
<!--
<button onclick="bnclk1()"><i><b>click me 1</b></i></button>
<h2 id="heading1">Display text</h2>
<button onclick="bnclk2()"><i><b>click me 2</b></i></button>
<h2 id="heading2">Display text</h2> -->
<button onclick="alrtMessage()"><i><b>alrtMessage</b></i></button>
</body>
</html>