- 2
Hello there.! Can anyone help me., I need a simple calculator using html and js., Pls help me
It contain four buttons like ➕✖️➖➗ Below the four buttons we need two value box's [Value 1] operator [value 2] equal button [result] If we click the operators the sign of an operator will shown in the place of operator.
3 odpowiedzi
0
Tapabrata Banerjee ok bro., If I click a oprater button. The sign of oprater will be shown in between the two input values., Pls tell me that how can I do that
0
showresult(choise){
var n1=parsefloat(document.getElementById('num1').value);
var n2=parsefloat(document.getElementById('num2').value);
var r;
var c=choise;
switch(c)
{
case '1':
r=n1+n2;
break;
case '2':
r=n1-n2;
break;
case '3':
r=n1*n2
break;
case '4':
r=n1/n2;
break;
case '5':
r=n2*100/n1;
break;
default:
break;
}
document.getElementById('result').innerHTML=r;
}
- 2
Thanks but. It's an assignment. So I need to do it as requirements