Hi guys. What am trying to do is to create a a simple calculator. The page will contain 3 textbox. First is the textbox for the 1st number, second textbox is for the second number and the third box is the where the user could input an arithmetic operator like + / * – …. I’m planning to do this as a switch apparently im having problems with it. Pls help guys … Here’s my code so far
[QUOTE]
<HEAD>
<title>Button</title>
<style type=”text/css”>
body
{
background-color:#B8BFD8;
}
</style>
<SCRIPT LANGUAGE=”JavaScript”>
switch(ans) {
case “+”:
document.write(“Answer: ” + ans)
break;
case “-“:
document.write(“Answer: ” + ans)
break;
case “*”:
document.write(“Answer: ” + ans)
case “/”:
document.write(“asnwer: ” + ans)
default:
document.write(“Not Applicable”)
}
</SCRIPT>
<BODY>
Enter first number:
<input type=number size=4 value=” ” name=”a”>
Enter second number:
<input type=number size=4 name=”b”>
Enter operator:
<input type=number size=4 name=”ans”>
</body>
</html>