function test(expn,a,b,c,d,m1,m2,m3) { var exp; var ret; exp = genExpress(expn,a,b,c,d,m1,m2,m3);//生成计算表达式 eval("ret = "+exp); if ( ret - 24 < 0.1 && ret - 24 >= 0 ) { exp = exp.replace(";",""); exp = replaceAll(exp,"*","×"); exp = replaceAll(exp, "/","÷"); var have = false; for ( var i=0; i<counter; i++) { if ( exp == answer[i] ) { have = true; break; } } if ( !have ) { answer[counter] = exp; counter++; log("<font color=red><b>"+counter+": "+exp+"</b></font>"); } } var n = new Array();//四个数字 希望看到更多更经典的开发技巧,请随时刷新《开发特区》栏目。
|
正在阅读:JavaScript基础实例:如何计算24点JavaScript基础实例:如何计算24点
2004-04-28 14:35
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键