importSelectQuestion:function(questionType){ // 自动导入选择题
var selStr = getClearSelectContent();
var selStrArr = selStr.split("</p>");
for(var i=0; i<selStrArr.length; i++){
selStrArr[i] = selStrArr[i] + "</p>";
}
resultSelectStr = selStrArr;
var endNum = 0;
var startNum = 0;
startNum = prompt("请输入开始序号:");
endNum = prompt("请输入结束序号:");
if(startNum == "") {
layer.msg("开始数值不正确");
return false;
}
if(endNum == "") {
layer.msg("结束数值不正确");
return false;
}
startNum = parseInt(startNum);
endNum = parseInt(endNum);
var result = "";
var intArr = [];
for (var i=startNum; i<=endNum; i++) {
for (var j=0; j<resultSelectStr.length; j++) {
if(-1 != resultSelectStr[j].indexOf("<p>"+ i)){
intArr[(i-1)] = j;
break; //匹配到一个之后就结束这个循环,进入下一个,这样可以保证1,10,这些首尾相同的序号重复的问题
}
}
}
for (var i=0; i<intArr.length; i++) {
if(i == intArr.length - 1){
for(var j=intArr[i]; j<resultSelectStr.length; j++){
result += resultSelectStr[j];
}
}else{
for(var j=intArr[i]; j<intArr[(i+1)]; j++){
result += resultSelectStr[j];
}
}
if(result != ""){
var subLength = new RegExp("<p>" + (i+1)).exec(result)[0].length;
result = result.substring(subLength + 1, result.length);
onSourceAddBtnClick(questionType, result);
}
result = "";
}
}