你好,欢迎来到电脑编程技巧与维护杂志社! 杂志社简介广告服务读者反馈编程社区  
合订本订阅
 
 
您的位置:技术专栏 / Linux开发
用ASP技术开发WEB调查(投票)系统 (11)
 

 }
    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)

  推荐精品文章

·2024年12月目录 
·2024年11月目录 
·2024年10月目录 
·2024年9月目录 
·2024年8月目录 
·2024年7月目录 
·2024年6月目录 
·2024年5月目录 
·2024年4月目录 
·2024年3月目录 
·2024年2月目录 
·2024年1月目录
·2023年12月目录
·2023年11月目录

  联系方式
TEL:010-82561037
Fax: 010-82561614
QQ: 100164630
Mail:gaojian@comprg.com.cn

  友情链接
 
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved
京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089