随机出题

      AS 2007-7-15 22:59

var myarry = new Array("+", "-", "*", "/");
var h;
function mycolor() {
 a.background = b.background=c.background=true;
 a.backgroundColor = b.backgroundColor=c.backgroundColor=0x00FFFF;
 a.border = b.border=c.border=d.border=true;
 a.borderColor = b.borderColor=c.borderColor=d.borderColor=0xff00ff;
}
b1_btn.onRelease = function() {
 e = myarry[random(4)];
 m = a.text=random(1000);
 n = b.text=random(1000);
 mycolor();
};
function da() {
 switch (e) {
 case ("+") :
  h = Number(m)+Number(n);
  break;
 case ("-") :
  h = Number(m)-Number(n);
  break;
 case ("*") :
  h = Number(m)*Number(n);
  break;
 case ("/") :
  h = Math.round((Number(m)/Number(n))*100)/100;
  break;
 }
}
b2_btn.onRelease = function() {
 d.background = true;
 d.backgroundColor = 0xff00ff;
 da();

if (c.text == h) {
  d.text = "恭喜,你答对了";
 } else {
  d.text = "好遗憾,加油呀";
 }
};
b3_btn.onRelease = function() {
 a.background = b.background=c.background=d.background=false;
 a.text = "";
 b.text = "";
 c.text = "";
 d.text = "";
 e = "";
};

b4_btn.onRelease = function() {
 da();
 c.text = h;
};

 压缩包下载

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}