jsで計算機を書く

2258 ワード




	
		
		Calaulate~
		
	

	
		
0
1 2 3 + C
4 5 6 - =
7 8 9 *
+/- 0 . /
var results = ""; var calres = ""; function calculater(){ if(event.srcElement.innerText=="="){ return; } if(event.srcElement.innerText=="C"){ del(); display.innerText="0"; return; } results += event.srcElement.innerText; display.innerText = results; } function resCal(){ calres=eval(results); display.innerText = calres; results = calres; } function del(){ results = ""; display.innerText = ""; }