Html Calculator

By DoruMolnar on Mar 13, 2016

I make an calculator for html:

<html><head></head><body bgcolor="#000000" text="gold"><input type="button" value="-" onclick="document.calculator.ans.value+='-'">

<title>Calculator</title>

<form name="calculator">
 <input type="button" value="1" onclick="document.calculator.ans.value+='1'">
<input type="button" value="2" onclick="document.calculator.ans.value+='2'">
<input type="button" value="3" onclick="document.calculator.ans.value+='3'">
<input type="button" value="+" onclick="document.calculator.ans.value+='+'">

<input type="button" value="4" onclick="document.calculator.ans.value+='4'">
<input type="button" value="5" onclick="document.calculator.ans.value+='5'">
<input type="button" value="6" onclick="document.calculator.ans.value+='6'">
<input type="button" value="-" onclick="document.calculator.ans.value+='-'">

<input type="button" value="7" onclick="document.calculator.ans.value+='7'">
<input type="button" value="8" onclick="document.calculator.ans.value+='8'">
<input type="button" value="9" onclick="document.calculator.ans.value+='9'">
<input type="button" value="*" onclick="document.calculator.ans.value+='*'">

<input type="button" value="/" onclick="document.calculator.ans.value+='/'">
<input type="button" value="0" onclick="document.calculator.ans.value+='0'">
<input type="reset" value="Reset">
<input type="button" value="=" onclick="document.calculator.ans.value=eval(document.calculator.ans.value)">
<br>Solution is <input type="textfield" name="ans" value="">
</form>

</body>
</html>

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.