CODE:-
<html>
<head>
<title>Square</title>
<style type="text/css">
body{
background-color:lightgreen;
}
.tab{
background-color:grey;
color:;
text-transform:capitalize;
}
.v1{
text-align:center;
background-color:orange;
}
.v2{
text-align:center;
background-color:yellow;
}
</style>
<script type="text/javascript">
function check()
{
var no=parseInt(document.f1.no.value);
var ans=no*no;
document.f1.ans.value=ans;
return false;
}
</script>
</head>
<body>
<center>
<form name="f1" method="post" onsubmit="return check()">
<table border="1" cellspacing="0" class="tab">
<tr class="v1">
<th colspan="2">to print square of given number</th>
</tr>
<tr>
<th>enter number:-</th>
<td><input type="text" name="no" size="5" style="border-radius:10px;"></td>
</tr>
<tr class="v1">
<td colspan="2">
<input type="submit" name="submit" value="Submit" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
<input type="reset" name="reset" value="Reset" style="border-radius:8px;background-color:red;color:white;font-weight:bold;border-color:green;">
</td>
</tr>
<tr>
<th>square of given number:-</th>
<td><input type="text" name="ans" size="5" style="border-radius:10px;"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
No comments:
Post a Comment