var temp = "";var arr = _g().getWidgetsByName("mark"); if (sum != 100.00) { if (arr[0] != undefined) { for (var i = 0; i < arr.length; i++) { temp = arr[i].getValue(); //如果控件长度大于1,则遍历获取控件值并拼接 if (temp > 100) { alert("Save Fail 1"); } } } else { temp = arr.getValue(); if (temp > 100) { alert("Save Fail"); } } alert("Save Fail ! Total Weight of Achievement have to be EXACT 100"); } else { if (arr[0] != undefined) { for (var i = 0; i < arr.length; i++) { temp = arr[i].getValue(); //如果控件长度大于1,则遍历获取控件值并拼接 if (temp > 100) { alert("Save Fail 1"); } } else if (arr[0] == undefined) { temp = arr.getValue(); if (temp > 100) { alert("Save Fail"); } } else { // js 始终不能执行这个部分 alert ("Save successful"); } } |