1. 對選擇的null值進行replace會出錯
var $listTimeMinite = $("#settingDateMinite").val(); //如果該文字框裡什麼都沒有,此時為null
if ($listTimeMinite == null || $listTimeMinite == "") {
$listTimeMinite = 55
} else {
$listTimeMinite = $("#settingDateMinite").val().replace("分", "");
}
2. 如果傳入Regex的temp為“”,則會出錯,即未定義正則
if (temp != "") {
var reg = eval("/" + temp + "/g");
testRes = reg.test($(".specConbineMark", $(this)).text());
if (testRes == true) {
$(".specConbineMark", $(this)).text($(".specConbineMark", $(this)).text().replace(reg, currentSpecValue));
}
}
3. reg.test()的值寫在if外面,用變數接收,寫在if的()裡面好像不穩定
testRes = reg.test($(".specConbineMark", $(this)).text());
if (testRes == true) {
$(".specConbineMark", $(this)).text($(".specConbineMark", $(this)).text().replace(reg, currentSpecValue));
}
4. bind與unbind hover,用mouseenter和mouseleave代替
$(".uploadImgItemPreview").unbind("hover");
$(".uploadImgItemPreview").bind({ "mouseenter": function () {
if (!$(".operateImg", $(this)).is(":animated")) {
$(".operateImg", $(this)).slideDown();
}
}, "mouseleave": function () {
$(".operateImg", $(this)).slideUp();
}
});