Click the start count to record the time you spend to solve the problem.
Click the stop count to pause the timer and resume the time by click the start count.
Click the reset count and the start count to reset the timer.
//var n=1;
//initial settings
var min1=1;
var max1=1;
var min2=12;
var max2=50;
var GONews;
var grid;
//counter
var h=0;
var m=0;
var s=0;
var c = 0;
var t;
var timer_is_on = 0;
function timedCount() {
s=s+1;
if (s==60){
m=m+1;
s=0;
}
if(m==60){
h=h+1;
m=0;
}
document.getElementById("txt").innerHTML = h + ":" + m + ":" + s;
if (h<10){
document.getElementById("txt").innerHTML = "0"+h + ":" + m + ":" + s;
if (s<10&&m<10)document.getElementById("txt").innerHTML = "0"+h + ":0" + m + ":0" + s;
if (s>10&&m<10)document.getElementById("txt").innerHTML = "0"+h + ":0" + m + ":" + s;
if (s<10&&m>10)document.getElementById("txt").innerHTML = "0"+h + ":" + m + ":0" + s;
}else if(m<10){
document.getElementById("txt").innerHTML = h + ":0" + m + ":" + s;
if (s<10)document.getElementById("txt").innerHTML = h + ":0" + m + ":0" + s;
}
//c = c + 1;
t = setTimeout(timedCount, 1000);
}
function startCount() {
if (!timer_is_on) {
timer_is_on = 1;
timedCount();
}
}
function stopCount() {
clearTimeout(t);
timer_is_on = 0;
}
function resetCount() {
clearTimeout(t);
timer_is_on = 0;
s=0;
m=0;
h=0;
document.getElementById("txt").innerHTML = "00:00:00";
}
function setHTML(id,text){
var e=document.getElementById(id);
if (e==null) return;
e.innerHTML=text;
}
function gravity (x){
x=Math.floor(x/50)*50;
return x+25;
}
class Movable {
static DOWN=1;
static UP=2;
static mouse=2;
static x1=0;
static y1=0;
static ctx;
static list=new Array();
static list1=new Array();
static list2=new Array();
static selected=null;
constructor(x,y){
this.x0=x;
this.y0=y;
this.fixed=false;
}
inside(x,y){
return true;
}
draw (ctx1){
;
}
move (e){
if (this.fixed==true) return;
var dx=e.offsetX-Movable.x1;
var dy=e.offsetY-Movable.y1;
this.x0+=dx;
this.y0+=dy;
Movable.x1=e.offsetX;
Movable.y1=e.offsetY;
this.draw(Movable.ctx);
}
fixPosition(x,y){
this.x0=x;
this.y0=y;
this.fixed=true;
}
static mouseUp() {
Movable.mouse=Movable.UP;
/*if (Movable.selected!=null){
Movable.selected.x0=gravity(Movable.selected.x0)+25;
Movable.selected.y0=gravity(Movable.selected.y0)+25;
}*/
}
static mouseDown(e) {
Movable.mouse=Movable.DOWN;
Movable.x1=e.offsetX;
Movable.y1=e.offsetY;
}
static isMouseDown() {
if (Movable.mouse==Movable.DOWN)
return true;
return false;
}
static isInside (e){
for (var i=0;i
3) {
// ?p=min1,max1,min2,max2
var s=paraStr.substring(3).split(/[=,]+/);
// alert(paraStr+" s[0]="+s[0]+" s["+(s.length-1)+"]="+s[s.length-1]);
if (s.length==2) {
//N=parseInt(s[0]);
//min1=parseInt(s[0]);
//max1=parseInt(s[1]);
//min2=parseInt(s[2]);
//max2=parseInt(s[3]);
}
// alert("min1="+min1+" "+max1+" "+min2+" "+max2);
}
//var n=getRndInteger(min1,max1);
//var randomNum=getRndInteger(min2,max2);
/*var Container1=new MyContainer(400,200,30,1,"blue");
var Container2=new MyContainer(470,200,30,2,"red");
var Container3=new MyContainer(400,300,30,3,"green");
var Container4=new MyContainer(470,300,30,4,"purple");*/
var Container1=new MyContainer (200,300,20,1,"blue");
var Container2=new MyContainer (300,300,20,2,"red");
var Container3=new MyContainer (400,300,20,3,"green");
var Container4=new MyContainer (500,300,20,4,"blue");
var Container5=new MyContainer (600,300,20,5,"red");
var Container6=new MyContainer (700,300,20,6,"green");
Movable.list1.push(Container1);
Movable.list1.push(Container2);
Movable.list1.push(Container3);
Movable.list1.push(Container4);
Movable.list1.push(Container5);
Movable.list1.push(Container6);
function showHint() {
if (hButton.sel===0)
return;
var str;
if (lang==0){
str="To make the sum equal to the product, the numbers must be very samll.";
}else{
str="为了使和等于积,数字必须比较小.";
}
hButton.hText.text=str;
hButton.hText.draw(ctx);
}
var hButton = new ToggleButton((canvas.width>>1)-100,canvas.height-30,200,30,"Show Hint", "Hide Hint",ctx,"green");
hButton.visible=true;
hButton.hText=new MyTextArea(500,170,450,"this is the hint","20px Arial","blue");
getRandomPara();
redraw(ctx);
showOrHide('foot',lang);
showOrHide('title1',lang);
showOrHide('title2',lang);
showOrHide('title3',lang);
setHTML('myBtn',word('Hint'));
) processed by MyLexV4 -->