Hello,
I have a JavaScript calculator, here is the code:
<script type="text/javascript">
var num1=prompt('Enter your first number',"");
var num2=prompt('Enter your second number',"");
var problem=prompt('Enter the operator you wish to use..x,X,+,-,/ are valid..',"");
if (problem=="+")
{
alert("The anwser to your equasion is "num1+num2);
}
else if (problem=="-")
{
alert("The answer to your equasion is "+num1-num2);
}
else if (problem=="/")
{
alert("The answer to your equasion is "+num1/num2);
}
else if (problem=="x")
{
alert("The answer to your equasion is "+num1*num2);
}
else if (problem=="X")
{
alert("The answer to your equasion is "+num1*num2);
}
else
{
alert("Sorry, we don't understand that equasion");
}
</script>
It will open when the page comes up, but how do I put it so that it opens when the user clicks a button?
Thanks