Pages

Thursday, January 27, 2011

Calulator using Javascript

Views
Please copy this code and paste in notepad and save as .html and see the output.



<html>
<head>
<title>Calculator</title>
<script language="javascript">
</script>
</head>
<body>
<center><h1>Calculator</h1>
<table border=5 bgcolor=black>
<tr>
<td bgcolor=yellow>
<input type="text" name="input" size=16 bgcolor=yellow>
</td>
</tr>
<tr>
<td align=right>
<font color=white><b>Calculator</font>
</td>
</tr>
<tr>
<td>
<input type="button" value=" 1 " onclick = " input.value += '1' ">
<input type="button" value=" 2 " onclick = " input.value += '2' ">
<input type="button" value=" 3 " onclick = " input.value += '3' ">
<input type="button" value=" + " onclick = " input.value += '+' ">
</td>
</tr>
<tr>
<td>
<input type="button" value=" 4 " onclick = " input.value += '4' ">
<input type="button" value=" 5 " onclick = " input.value += '5' ">
<input type="button" value=" 6 " onclick = " input.value += '6' ">
<input type="button" value=" - " onclick = " input.value += '-' ">
</td>
</tr>
<tr>
<td>
<input type="button" value=" 7 " onclick=" input.value += '7' ">
<input type="button" value=" 8 " onclick=" input.value += '8' ">
<input type="button" value=" 9 " onclick=" input.value += '9' ">
<input type="button" value=" * " onclick=" input.value += '*' ">
</td>
</tr>
<tr>
<td>
<input type="button" value=" c " onclick=" input.value = ' ' ">
<input type="button" value=" 0 " onclick=" input.value += '0' ">
<input type="button" value=" = " onclick=" input.value =eval(input.value)">
<input type="button" value=" / " onclick=" input.value += '/' ">
</td>
</tr>
</form>
</table>
</body>
</html>

0 comments:

Post a Comment

 

Web Design Company karimnagar, Web Designing warangal, Logo Design Company nizamabad, Indian Website Design Company, maddysoft.co.in