http://community.csdn.net/Expert/topic/3735/3735144.xml?temp=8.680362E-02 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleJavascript版 v1.0/title
META HTTP-EQUIV=REFRESH CONTENT=10; URL=*.*
meta http-equiv=Content-Type content=text/html; charset=GB2312
/head
body
br
计算24点 Javascript版 v1.0brbr
brbrbrbr
form
div
时间限制brbr
input type=text name=fa value=%=l1% size=10
input type=text name=fb value=%=l2%size=10
input type=text name=fc value=%=l3%size=10
input type=text name=fd value=%=l4%size=10
brbrinput type=button name=btn onclick=javascript:funCount value=查看答案
/div/form
script language=JavaScript
function log
document.write;
//生成计算表达式
function genExpress
var
exp=exp.replace;
exp=exp.replace;
exp=exp.replace;
exp=exp.replace;
exp=exp.replace;
exp=exp.replace;
exp=exp.replace;
return exp;
var answer = new Array;//正确答案的表达式
var counter = 0;//答案的个数
//测试表达式是否正确
function test
var exp;
var ret;
exp = genExpress;//生成计算表达式
eval;
if
exp = exp.replace;
exp = replaceAll;
exp = replaceAll;
var have = false;
for
if
have = true;
break;
if
answer[counter] = exp;