我试图执行一个if/elseif/else
语句,但我在第二个else if
上得到一个意外的标识符错误。语句的其余部分运行良好。我是一个非常新的编码,所以我道歉,如果这是一个简单的错误。
if (jQuery("#question").val() === "" && (rowCount == 1)) {
analysis_empty=1;
} else if (rowCount > 1) {
jQuery('.analysis_empty_title').css({"line-height":"normal"});
jQuery('.analysis_empty_title').text("Results Displayed by Date Groups");
jQuery('#here').html(jQuery('#dategrouptable').clone().attr('id', 'tableb_copy'));
jQuery('#tableb_copy').css({"font-style":"italic"});
var ptr = jQuery("#tableb_copy").find("tr");
ptr.find("td:last").remove();
} else if ((rowCount > 1) and (jQuery("#question").val() != "" )){
jQuery('#analquestion_empty').css({"display":"none"});//ERROR HERE
} else {
analysis_empty=0;
jQuery('#analquestion_empty').css({"display":"none"});
}
任何想法吗?
问题是你使用的and
关键字,因为它在Javascript中不存在。
应替换为&&
,例如:
else if ((rowCount > 1) && (jQuery("#question").val() != "" )){
with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : { __proto__: null }) {
if (jQuery("#question").val() === "" && (rowCount == 1)) {
analysis_empty=1;
} else if (rowCount > 1) {
jQuery('.analysis_empty_title').css({"line-height":"normal"});
jQuery('.analysis_empty_title').text("Results Displayed by Date Groups");
jQuery('#here').html(jQuery('#dategrouptable').clone().attr('id', 'tableb_copy'));
jQuery('#tableb_copy').css({"font-style":"italic"});
var ptr = jQuery("#tableb_copy").find("tr");
ptr.find("td:last").remove();
} else if ((rowCount > 1) && (jQuery("#question").val() != "" )){
jQuery('#analquestion_empty').css({"display":"none"});//ERROR HERE
} else {
analysis_empty=0;
jQuery('#analquestion_empty').css({"display":"none"});
}
}