我们刚刚释放了一个网上商店。
On this page the selectboxes crashes Internet Explorer 7 on some computers. Never on my computer. Does anybody knows why?
Live link: http://velour.se/collection/women/tops/eloise
A. 更新: turns out that the first like I posted did not crash.
But the following does: http://velour.se/collection/women/outerwear/irina
<>原件:
<select id="sizeDD" onchange="javascript:SizeChange(this);"></select>
//Internet Explorer problem.
function SizeChange(e){
DrawAmountDD(GetAmountById(e.value));
}
这里,我认为可能涉及法典的一部分:
function DrawAmountDD(maxAmount){
/*var max = parseInt(maxAmount) > parseInt(maxShowAmount) ? maxShowAmount : maxAmount;
var html = "";
for(var i=1; i <= max; i++){
html += "<option value= " + i + " >" + i + "</option>";
}
$("#amountDD").html(html);*/
var max = parseInt(maxAmount) > parseInt(maxShowAmount) ? maxShowAmount : maxAmount;
var ddlAmount = document.getElementById("amountDD");
ddlAmount.length=max;
for(var a=1; a <= max; a++){
ddlAmount.options[a-1].value = a;
ddlAmount.options[a-1].text = a;
}
}
第2版
<select id="sizeDD"></select>
<select id="amountDD"></select>
<script type="text/javascript">
var maxShowAmount = 5 ;
var colorSizeArr =
{ "colSize":
[
{ "color": "Black/Offwhite",
"specificId": "2",
"size": "XS",
"amount": "1" }
]
};
colorSizeArr.colSize.push(
{ "color": "Black/Offwhite",
"specificId": "13",
"size": "S",
"amount": "2" });
$(document).ready(function () {
var selectSizeDD = document.getElementById( sizeDD );
selectSizeDD.onchange = function () { sizeChange(selectSizeDD); };
});
function sizeChange(e) {
DrawAmountDD(GetAmountById(e.value));
}
function GetAmountById(specificId) {
for (var i = 0; i < colorSizeArr.colSize.length; i++) {
if (colorSizeArr.colSize[i].specificId == specificId) {
return colorSizeArr.colSize[i].amount;
}
}
return 1;
}
function DrawAmountDD(maxAmount) {
var max = parseInt(maxAmount) > parseInt(maxShowAmount) ? maxShowAmount : maxAmount;
var html = "";
for (var i = 1; i <= max; i++) {
html += "<option value= " + i + " >" + i + "</option>";
}
$("#amountDD").html(html);
}
</script>
A. 更新
我没有夸张为什么因特网探索者7在一些电脑上坠毁。 无论怎样,上述法典都与它毫不相干。 更为简单。 浏览器在点击只有一个选择的选箱时坠毁。 与此类似:
<select id="amountDD">
<option value="1">1</option>
</select>
我发现,这一联系有一些动因,其中说,单一选择也应有某些属性,但对我们来说,这似乎有错。