Performing Add, Sub, Multiply,Divide.
<HEAD><CENTER> </center></HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
function fadd_click()
{
accept();
document.f1.c.value=eval(x)+eval(y);
}
function fdiff_click()
{
accept();
document.f1.c.value=eval(x)-eval(y);
}
function fmult_click()
{
accept();
document.f1.c.value=eval(x)*eval(y);
}
function fQuo()
{
accept();
document.f1.c.value=eval(x)/eval(y);
}
function accept()
{
x=window.prompt("enter the value");
y=window.prompt("enter the value");
}
</SCRIPT>
<BODY>
<FORM NAME=f1>
<CENTER>
<INPUT TYPE=BUTTON NAME=B1 VALUE=" + " onClick="fadd_click()">   
<INPUT TYPE=BUTTON NAME=B4 VALUE=" - " onClick="fdiff_click()">   
<INPUT TYPE=BUTTON NAME=B2 VALUE=" * " onClick="fmult_click()">   
<INPUT TYPE=BUTTON NAME=B3 VALUE="/" onClick="fQuo()">   
<INPUT TYPE = TEXT NAME="c">   
</center>
</FORM>
</BODY>
</HTML>
<HEAD><CENTER> </center></HEAD>
<SCRIPT LANGUAGE="JAVASCRIPT">
function fadd_click()
{
accept();
document.f1.c.value=eval(x)+eval(y);
}
function fdiff_click()
{
accept();
document.f1.c.value=eval(x)-eval(y);
}
function fmult_click()
{
accept();
document.f1.c.value=eval(x)*eval(y);
}
function fQuo()
{
accept();
document.f1.c.value=eval(x)/eval(y);
}
function accept()
{
x=window.prompt("enter the value");
y=window.prompt("enter the value");
}
</SCRIPT>
<BODY>
<FORM NAME=f1>
<CENTER>
<INPUT TYPE=BUTTON NAME=B1 VALUE=" + " onClick="fadd_click()">   
<INPUT TYPE=BUTTON NAME=B4 VALUE=" - " onClick="fdiff_click()">   
<INPUT TYPE=BUTTON NAME=B2 VALUE=" * " onClick="fmult_click()">   
<INPUT TYPE=BUTTON NAME=B3 VALUE="/" onClick="fQuo()">   
<INPUT TYPE = TEXT NAME="c">   
</center>
</FORM>
</BODY>
</HTML>
No comments:
Post a Comment
Thank you for visiting my blog