日期:2014-05-20  浏览次数:20997 次

怪事怪事勒
//自定义按钮的显示与隐藏

function showDiyDIV() {
alert("in showDivDIV");
$("#strBegin").val(strNowDate);
$("#strEnd").val(strNowDate);
changeTimeButton(); if ($("#diyDIV").css("display") == "inline") {
hideTips();
$("#diyDIV").css("display", "none");
} else {
$("#diyDIV").css("display", "inline");
}
}
//切换选中时间段按钮的样式

function changeTimeButton(type) {
alert("type1111:"+type);
var size = $("input[name='timeInput']").length;
for (i = 0; i < size; i++) {
$("input[name='timeInput']:eq(" + i + ")").attr('class', 'btn_date_off');
}
if (type == null || type == "") {
var timeFlag = 5;
 alert("in if type=" + type);
} else {
   
var timeFlag = type - 1;
alert("timeFlag =" + timeFlag);
}
$("input[name='timeInput']:eq(" + timeFlag + ")").attr('class', 'btn_date_on');

}

以上代码,当type=undefined 时,为什么还能进入

if (type == null || type == "") {
var timeFlag = 5;
 alert("in if type=" + type);
}
????,郁闷不已啊,

呵呵呵呵
------解决方案--------------------
undefined 不就是null了吗?
------解决方案--------------------
undefined------未定义