<html>
<head>
<script language="vbscript" type="text/vbscript">
function sum()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)+CInt(b)
Msgbox a&"+"&b&"="&c
end function
function subtract()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)-CInt(b)
Msgbox a&"-"&b&"="&c
end function
function multiply()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)*CInt(b)
Msgbox a&"*"&b&"="&c
end function
function divide()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)/CInt(b)
Msgbox a&"/"&b&"="&c
end function
</script>
</head>
<body>
<form name="calc" method="POST">
Enter first value:<input type="text" name="text1"><br>
Enter Second value:<input type="text" name="text2"><br><br><br>
<input type="button" OnClick='sum()' value="add">
<input type="button" OnClick='subtract()' value="sub">
<input type="button" OnClick='divide()' value="div">
<input type="button" OnClick='multiply()' value="mul">
</form>
</body>
</html>
<head>
<script language="vbscript" type="text/vbscript">
function sum()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)+CInt(b)
Msgbox a&"+"&b&"="&c
end function
function subtract()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)-CInt(b)
Msgbox a&"-"&b&"="&c
end function
function multiply()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)*CInt(b)
Msgbox a&"*"&b&"="&c
end function
function divide()
Dim a,b,c
a=document.calc.text1.value
b=document.calc.text2.value
c=CInt(a)/CInt(b)
Msgbox a&"/"&b&"="&c
end function
</script>
</head>
<body>
<form name="calc" method="POST">
Enter first value:<input type="text" name="text1"><br>
Enter Second value:<input type="text" name="text2"><br><br><br>
<input type="button" OnClick='sum()' value="add">
<input type="button" OnClick='subtract()' value="sub">
<input type="button" OnClick='divide()' value="div">
<input type="button" OnClick='multiply()' value="mul">
</form>
</body>
</html>
No comments:
Post a Comment