-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
72 lines (62 loc) · 1.72 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find Square</title>
<style>
*{
font-size: 40px;
font-family: Arial, Helvetica, sans-serif;
}
body{
background-color: #EDEADE;
}
#nav{
background-color: black;
height:50px;
}
#nav a{
color: white;
text-decoration: none;
margin: 20%;
}
#nav a:hover {
border-bottom: 2px solid;
}
</style>
</head>
<body>
<center>
<div id="nav">
<a href="#">Home</a>
<a href="aboutUs.html">About Us</a>
</div>
<h1>Find Square Of A Number</h1>
<form onsubmit="compute()">
<label for="num">Number: </label>
<input type="number" step="any" placeholder="Enter Number" id="num">
<br><br>
<input type="submit" value="Compute">
</form>
</center>
<script>
function compute()
{
event.preventDefault();
let num=document.getElementById("num");
let msg=document.getElementById("msg");
if(num.value=="")
{
alert("You didn't enter number");
num.focus();
return;
}
let n=parseFloat(num.value);
let r=n*n;
localStorage.setItem("res",r);
window.location.href="result.html";
}
</script>
</body>
</html>