你好,我有這個代碼在Firefox中工作完美,但在IE 8不起作用,不給我任何錯誤?!IE的jquery問題在FF工作正常
$(".shp_div").change(function() {
var str = "";
$("select option:selected").each(function() {
var countprod =parseInt($("#countprod").val());
var str2 = $(this).val();
str2_array = str2.split('|');
var cost = parseInt(str2_array[0]);
var cost_extra = parseInt(str2_array[1]);
if ($("#countprod").val()>1) {
str = parseInt(((countprod-1)*cost_extra) + cost);
} else{
str = cost;
}});
$(".csq_item2").text(str);
var total =parseInt($("#subtotal").val());
var shipping=parseInt(str + total);
$(".price_total").text(shipping);
})
.change();
爲了獲得「全貌」請去爲:http://poshsunglasses.net/21-Bottega_Veneta-B.V.88.html,並添加到購物車督促,然後在購物車頁面上嘗試在FF選擇送貨的國家做出的計算在IE沒有。
謝謝
可能與您的問題無關,但您應該小心使用'parseInt'而不指定基數。如果要解析的字符串以「0x」或「0」開頭,則該字符串將分別解析爲十六進制或八進制。請參閱https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/parseInt。 – 2010-08-18 09:29:12