测验时长和题目分数增加数字验证

This commit is contained in:
cxt 2015-11-25 10:24:46 +08:00
parent 1ae514ca48
commit 3e0609afe3
1 changed files with 6 additions and 0 deletions

View File

@ -87,6 +87,8 @@
var standard_ans = $.trim($("#question_standard_ans").val());
if(title.length == 0 || score.length == 0){
alert("题目标题/分数不能为空");
}else if(!/^[1-9][0-9]*$/.test(score)) {
alert("分数必须是非零开头的数字");
}else if(quest_type !=3 && standard_ans.length == 0) {
alert("标准答案不能为空");
}else{
@ -100,6 +102,8 @@
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
if(title.length == 0 || score.length == 0){
alert("题目标题/分数不能为空");
}else if(!/^[1-9][0-9]*$/.test(score)) {
alert("分数必须是非零开头的数字");
}else if(quest_type !=3 && standard_ans.length == 0) {
alert("标准答案不能为空");
}else{
@ -116,6 +120,8 @@
alert("截止时间不能为空");
} else if(Date.parse($("#exercise_end_time").val()) < Date.now()) {
alert("截止时间不能小于当前时间");
} else if($.trim($("#exercise_time").val()) !="" && !/^[1-9][0-9]*$/.test($.trim($("#exercise_time").val()))) {
alert("测验时长必须为非零开头的数字");
}
else {
doc.parent().parent().parent().submit();