Tuesday, September 7, 2010

html calculator

<html>
<head > <h1 align= "center" >Calculator<h1>
<title>CALCULATOR</title>
<table><tr height = 50 width =50 border =1>
<marquee direction = "up" onmouseover = "this.stop();" onmouseout = "this.start();">
<a href = "http://sathia27.wordpress.com" >MY BLOG</a><a href >
</br><input type = "submit" value = "CLICK ME!!" id = "new" onclick = "neww()">
</marquee>
</tr>
</table>
<script type "text/javascript">
function addition()
{
var x = parseInt(document.getElementById("int").value);
var y = parseInt(document.getElementById("so").value);
document.getElementById("z").value=x+y;

}
function subtraction()
{
var x = parseInt(document.getElementById("int").value);
var y = parseInt(document.getElementById("so").value);
document.getElementById("z").value=x-y;

}
function multiplication()
{
var x = parseInt(document.getElementById("int").value);
var y = parseInt(document.getElementById("so").value);
document.getElementById("z").value=x*y;

}
function division()
{
var x = parseInt(document.getElementById("int").value);
var y = parseInt(document.getElementById("so").value);
document.getElementById("z").value=x/y;
}
function neww()
{
alert("helo, Scientific calculator will come soon!!!!")

}
</script>
</head>
<body bgcolor = "pink">   

<table bgcolor="black" border = 1 align ="center" width = 30% height = 80  >
<tr>
<td><font color = "white">FIRST VALUE</td><td><input vaule = "x" name = "first value" id ="int"></font></td></tr>

<tr><td><font color = "white">SECOND VALUE</td><td><input vaule = "y" name = "first value" id ="so"></td></tr>

<tr><td><input value = "z" name = "ans" id = "z"></td></tr>
<tr><td>
<input type = "submit" name = "add" value ='+' onclick = "addition()">

<input type ="button" name = "sub" value = "-" onclick = "subtraction()">

<input type ="button" name = "mult" value = "*" onclick = "multiplication()">

<input type ="button" name = "divi" value = "/" onclick = "division()">
</td></tr>
</table>
</body>


</html>