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>");
}
}
}
function replaceAll (streng, soeg, erstat)
{
var st = streng;
if (soeg.length == 0)
return st;
var idx = st.indexOf(soeg);
while (idx >= 0)
{
st = st.substring(0,idx) + erstat + st.substr(idx+soeg.length);
idx = st.indexOf(soeg);
}
return st;
}
var n = new Array();//四個數字
//接收四個輸入框的數字,調用主程式
function funCount()
{
n[0] = document.forms[0].fa.value;
n = document.forms[0].fb.value;
n = document.forms[0].fc.value;