1
2
3
4
5
Insert title here6
7 varstr;8 varnum;9 functioncount(ch)10 {11 str=document.getElementById("show");12 if(ch=="C")13 {14 str.value="0";15 }16 else if(ch=="←")17 {18 str.value=str.value.substr(0,str.value.length-1);19 if(str.value.length==0)20 str.value="0";21 }22 else if(ch==‘%‘&&str.value=="0")23 {24 ;25 }26 else
27 {28 if(str.value=="0")29 str.value="";30 str.value=str.value+ch;31 }32 }33 functionans()34 {35 str=document.getElementById("show");36 num=eval(str.value);37 str.value=num;38 }39
40
41
42
43 计算器
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71