-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMisc_Codes.html
141 lines (109 loc) · 2.98 KB
/
Misc_Codes.html
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!--<script>
let userName = prompt("Who is this?", '')
if (userName.toUpperCase() == 'ADMIN')
{
let pwd = prompt("Please enter password", '')
if (pwd == null || pwd == '')
{
pwd = prompt("Please enter password", '')
}
else
{
if (pwd == 'password')
alert("You are logged in!!!");
else
pwd = prompt("Wrong password", '')
}
}
else
{
alert("Only admins are allowed to use the application!!!")
}
</script>-->
<script>
////Rewrite the below into if ?
////if (a + b < 10) {
//// result = 'Below';
////} else {
//// result = 'Over';
////}
//let a = prompt("Input first number", 0);
//let b = prompt("Input second number", 0);
//let resultVar = a + b < 10 ? 'Below' : 'Over';
//alert(resultVar);
////Rewrite if..else using multiple ternary operators '?'.
////let message;
////if (login == 'Employee') {
//// message = 'Hello';
////} else if (login == 'Director') {
//// message = 'Greetings';
////} else if (login == '') {
//// message = 'No login';
////} else {
//// message = '';
////}
//let empType = prompt("Enter your employment type", '');
//let message = '';
//if (empType == 'employee' ? message = 'Hello' :
// empType == 'director' ? message = 'Greetings' :
// message = 'No login.');
//alert(message);
//function sayHi() { // (1) create
// alert("Hello");
//}
//let func = sayHi; // (2) copy
//func();
//let sayHi2 = function () {
// alert("Hi2");
//}
//let func2 = sayHi2;
//func2();
//sayHi2();
//let sayHi3 = () => {
// alert("Hi3");
//}
//sayHi3();
//let user = {
// fName: "Arun",
// lName: "Thomas",
// age: 36,
//}
//alert(user.fName);
/* let empSal = {
Arun: 100,
xyz: 50,
zzz: 25,
}
let totSal = 0;
for (let sal in empSal) {
totSal += empSal[sal];
}
alert(totSal);
*/
</script>
<button id="btnExecuteAjax">Call Ajax</button>
<button id="btnLoadCustomer"> Load Customer from JSON by Ajax call</button>
<button id="btnLoadCustomers"> Load Customer from JSON by Ajax call</button>
<div id="container">
<form id="myForm">
<tr></tr>
<tr></tr>
<tr>
<input type="number" id="txtNoOfJokes" value="1">
<button id="btnLoadJokes">Load Jokes</button>
</tr>
</form>
</div>
</body>
<script src="Ajax_Codes.js"> </script>
<script src="Customer_JSON_Ajax.js"></script>
<script src="Customers_JSON_Ajax.js"></script>
<script src="External_JSON_Ajax.js"></script>
</html>