html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<link href="http://fonts.googleapis.com/css?family=Sofia|Libre+Baskerville|Tangerine" rel="stylesheet"/>
<title>Page Title</title>
</head>
<body>
<p class="p">Upvote If You Like</p>
<input onfocus="reset()" type="number" id="demo" placeholder="Number"/><p id="p" onclick="aler()">☰</p>
<br>
<input type="number" id="dem" placeholder="Answer"/>
<br/>
<button onclick="square()">Square</button>
<br/>
<button onclick="square1()" id="b">Square Root</button>
<br />
<button id="margin" onclick="reset()">Reset</button>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
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
#demo,#dem{
width:150px;
text-align:center;
border-radius:8px;
Border:2px solid #ebebeb;
padding:3px;
margin:3px 20px 12px;
font-size:15px;
font-family:"Libre Baskerville";
color:#3b5998;
font-weight:bold;
}
#demo{
margin-top:20px;
}
input:focus{
outline:none;
background-color:rgb(240,240,240);
}
button{
width:159px;
padding:3px;
margin:6px 20px;
border-radius:5px;
font-family:Sofia;
font-size:15px;
background:#3b5998;
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function square(){
var i = document.getElementById("demo").value;
var n = document.getElementById("dem");
var a = i*i;
n.value = Number(a.toFixed(5))
}
function square1(){
var i = document.getElementById("demo").value;
var n = document.getElementById("dem");
n.value = parseFloat(Math.sqrt(i).toFixed(3));
}
function aler(){
alert("write number and press square or square root button")
}
function reset(){
var i = document.getElementById("demo");
var n = document.getElementById("dem");
i.value = "";
n.value = "";
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run