} IType++; NoOpinion = (document.ItemType.NoOpinion.checked) ? "Y" : "N"; stemArray[stemLen] = INumber + IType + NoOpinion; if (IType > 3) ACount = parseInt(document.ItemType.nChoices.value); else if (IType == 3) ACount = 2; // 语义区别 else ACount = 0; if (ACount > 26) Acount = 26; if (ACount > 0) { j = ansArray.length; for (i=0; i< ACount; i++) ansArray[j+i] = INumber + String.fromCharCode(65+i); } stemIx = stemLen; doNav(""); // 显示空白的问题 } // doNew() doMove()函数修改问题在调查项目中的位置(序号),它先将指定问题与答案在各自的数组中重新编号,然后将这两个数组排序: // 将问题移到指定位置之后 function doMove() { if (stemArray.length < = 0) return; // 没有已定义的问题 ID = stemArray[stemIx].substr(0,3); // 要移动问题的ID QTemp = document.ItemType.IAfter.value; // 移到哪里 if (QTemp >= 0 && QTemp < stemArray.length) NID = stemArray[QTemp].substr(0,3); // 被移动问题新的ID else if (QTemp == stemArray.length) NID = stemArray[stemArray.length-1].substr(0,3); else return; minID = (ID< NID) ? ID : NID; maxID = (ID< NID) ? NID : ID; offset = (ID< NID) ? -1 : 1; // 移动方向 for (i=0; i< stemArray.length; i++) { thisID = stemArray[i].substr(0,3); if (thisID>=minID && thisID< =maxID) { if (thisID == ID) stemArray[i] = NID + stemArray[i].substr(3); else { tempID = " " + (parseInt(thisID) + offset).toString(); tempID = tempID.substr(tempID.length-3, 3); stemArray[i] = tempID + stemArray[i].substr(3); } } } stemArray.sort(); for (i=0; i< ansArray.length; i++) { thisID = ansArray[i].substr(0,3); if (thisID>=minID && thisID< =maxID) { if (thisID == ID) ansArray[i] = NID + ansArray[i].substr(3); else { tempID = " " + (parseInt(thisID) + offset).toString(); tempID = tempID.substr(tempID.length-3, 3); ansArray[i] = tempID + ansArray[i].substr(3); } } } ansArray.sort(); document.ItemType.INumber.value = NID; doNav("Go->"); // 显示移动后的问题
(编辑:aniston)
|