-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput JS
253 lines (211 loc) · 4.68 KB
/
input JS
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>input JS</title>
</head>
<body>
<h2>
Enter any number : <input id="no_input" placeholder="num.">
</h2>
<br>
<button onclick="enter_input()">Click Me</button>
</body>
<script>
function enter_input()
{
var no;
no = Number(document.getElementById("no_input").value);
alert("your input number is " + no);
}
</script>
</html> -->
<!-- // Calculater -->
<!--
<html>
<head>
<script>
function dis(val)
{
document.getElementById("result").value+=val ;
}
function solve()
{
var x = document.getElementById("result").value;
var y = eval(x) ;
document.getElementById("result").value = y ;
}
function clr()
{
document.getElementById("result").value = "" ;
}
</script>
<style>
.title{
margin-bottom: 10px;
text-align:center;
width: 220px;
color:green;
border: solid black 2px;
}
input[type="button"]
{
background-color:orange;
color: black;
border: solid black 2px;
width:100%
}
input[type="text"]
{
background-color:white;
border: solid black 2px;
width:100%
}
</style>
</head>
<body>
<div class = title >Simple Calculator</div>
<table border="1">
<tr>
<td colspan="3"><input type="text" id="result"/></td>
<td><input type="button" value="c" onclick="clr()"/> </td>
</tr>
<tr>
<td><input type="button" value="1" onclick="dis('1')"/> </td>
<td><input type="button" value="2" onclick="dis('2')"/> </td>
<td><input type="button" value="3" onclick="dis('3')"/> </td>
<td><input type="button" value="/" onclick="dis('/')"/> </td>
</tr>
<tr>
<td><input type="button" value="4" onclick="dis('4')"/> </td>
<td><input type="button" value="5" onclick="dis('5')"/> </td>
<td><input type="button" value="6" onclick="dis('6')"/> </td>
<td><input type="button" value="-" onclick="dis('-')"/> </td>
</tr>
<tr>
<td><input type="button" value="7" onclick="dis('7')"/> </td>
<td><input type="button" value="8" onclick="dis('8')"/> </td>
<td><input type="button" value="9" onclick="dis('9')"/> </td>
<td><input type="button" value="+" onclick="dis('+')"/> </td>
</tr>
<tr>
<td><input type="button" value="." onclick="dis('.')"/> </td>
<td><input type="button" value="0" onclick="dis('0')"/> </td>
<td><input type="button" value="=" onclick="solve()"/> </td>
<td><input type="button" value="*" onclick="dis('*')"/> </td>
</tr>
</table>
</body>
</html> -->
<!-- even or odd -->
<!-- <!doctype html>
<html>
<head>
<script>
function odd_even(){
var no;
no=Number(document.getElementById("no_input").value);
if(no%2==0)
{
alert("Even Number");
}
else
{
alert("Odd Number");
}
}
</script>
</head>
<body>
Enter Any Number:<input id="no_input"><br />
<button onclick="odd_even()">Click me</button>
</body>
</html> -->
<!-- prime or not -->
<!-- <!DOCTYPE html>
<html>
<head>
<title>
Check a number is Prime or
not using JavaScript
</title>
<script type="text/javascript">
function p() {
var n, i, flag = true;
n = document.getElementById("myform").n.value;
n = parseInt(n)
for(i = 2; i <= n - 1; i++)
if (n % i == 0) {
flag = false;
break;
}
if (flag == true)
alert(n + " is prime");
else
alert(n + " is not prime");
}
</script>
</head>
<body>
<center>
<h1>prime or not</h1>
<hr color="Green">
<form id="myform">
Enter the number:
<input type="text" name=n value="">
<br><br>
<input type="button" value="Check" onClick="p()">
<br>
</form>
</center>
</body>
</html>
-->
<!-- leap year -->
<!-- <!DOCTYPE>
<html>
<head>
<script>
function check_leapyear(){
var year;
year = document.getElementById("year").value;
if( (0 == year % 4) && (0 != year % 100) || (0 == year % 400) )
{
alert(year+" is a leap year");
}
else
{
alert(year+" is not a leap year");
}
}
</script>
</head>
<body>
<h3>Javascript Program to find leap year</h3>
<input type="text" id="year"></input>
<button onclick="check_leapyear()">Check</button>
</body>
</html>
-->
<!-- input prompt -->
<!DOCTYPE html>
<html>
<head>
<title>input prompt</title>
</head>
<body>
<h2>Landing Page</h2>
<button onclick="myFunc()">Click me </button>
<h3 id="demo"></h3>
</body>
<script type="text/javascript">
myFunc()
{
var person = prompt("Please enter your name ", "FIEM");
if(person != null){
document.getElementById("demo").innerHTML = "Hello "+ person + "!How are you today?"
}
}
</script>
</html>