Ads

LightBlog

Latest

Saturday, April 17, 2021

Simple Calculator Using HTML

//*Simple Calculator Using HTML



<html>
<head><h1>calculator</h1></head><hr>
<title>my calculator</title>
<body>
<center>
<form name="calculator">

<input type="text" name="display" style="width:200px;height:90px;background-color:black;color:white;" placeholder="0"><br><br>

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="9" onClick="document.calculator.display.value+='9'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="8"  onClick="document.calculator.display.value+='8'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="7"  onClick="document.calculator.display.value+='7'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="6"  onClick="document.calculator.display.value+='6'"><br><br>

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="5"  onClick="document.calculator.display.value+='5'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="4"  onClick="document.calculator.display.value+='4'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="3"  onClick="document.calculator.display.value+='3'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="2"  onClick="document.calculator.display.value+='2'"><br><br>

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="1"   onClick="document.calculator.display.value+='1'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="0"   onClick="document.calculator.display.value+='0'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="+"   onClick="document.calculator.display.value+='+'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="-"   onClick="document.calculator.display.value+='-'"><br><br>

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="/"   onClick="document.calculator.display.value+='/'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="%"   onClick="document.calculator.display.value+='%'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="*"   onClick="document.calculator.display.value+='*'">

<input type="button" style="width:30px;height:30px;background-color:orange;color:black;"  value="."   onClick="document.calculator.display.value+='.'"><br><br>

<input type="reset" style="width:65px;height:30px;background-color:orange;color:black;"  value="C"   onClick="document.calculator.display.value=eval(document.calculator.display.value)">


<input type="button" style="width:65px;height:30px;background-color:orange;color:black;"  value="="   onClick="document.calculator.display.value=eval(document.calculator.display.value)">
<center>
</form>
</body>
<html>

No comments:

Post a Comment