在这个上绞尽脑汁.我有以下代码:JavaScript游戏的第一阶段.所有对象都是明确定义的,我正在使用jQuery进行DOM交互.该谜题是使用以下JS代码创建的:
var mypuzzle = new puzzle("{solution:'5+6+89',equations:[['5+3=8',23,23],['5+1=6',150,['5+3=6',230,23]]}");
但是,代码底部的循环不会比第一次迭代更进一步.知道为什么吗?根本没有错误.
function equationBox(equation,top,left) {//draggable equation Box
this.reposition = function() {
this.top = 0;
this.left = 0;
}
this.top = 0;//make random
this.left = 0;//make random
this.equation = equation;
if(top && left) {
this.top = top;
this.left = left;
}
this.content = this.equation.LHS.string + 'Box = function(equationBox) {
$('#puzzle #equations').append(equationBox.DOM);
}
this.init = function() {
//this.drawPuzzleBox();
this.json = JSON.parse(json);
this.solution = new expression(this.json.solution || '');
this.equations = this.json.equations || [];
var iterations = this.equations.length;
for(i=0;iBox(new equationBox(stringToEquation(this.equations[i][0]),this.equations[i][1],this.equations[i][2]));
}
}
this.init();
}
最佳答案
原文链接:https://www.f2er.com/js/429032.html