日期:2014-05-16 浏览次数:20315 次
<script language=javascript> function sub(){ var sum,n1,n2,n3,res; sum = t0.value-0; n1 = 1; n2 = 2; n3 = 3; res = sum % (n1 + n2 + n3); tim = (sum - res) / (n1 + n2 + n3); t1.value = n1*tim; t2.value = n2*tim; t3.value = n3*tim; t4.value = res; if(res == 0){ alert("yes"); }else{ alert("no"); } } </script> <input type="text" name="t0" /> </p> <p> 1 <input type="text" name="t1" /> 2 <input type="text" name="t2" /> 3 <input type="text" name="t3" /> 4 <input type="text" name="t4" /> <input type="button" onclick = "sub()">