建議使用markdown語法格式化一下JS代碼,提高適讀性,如:
var arr1 = {
"attributes": {
"1": {
"id": "1",
"options": [{
"id": "2",
"products": ["4", "5"]
}, {
"id": "3",
"label": "0.05Ohm",
"price": "3",
"oldPrice": "3",
"products": ["6"]
}
]
},
"7": {
"id": "7",
"options": [{
"id": "8",
"products": ["4"]
}, {
"id": "9",
"products": ["10"]
}
]
}
},
"template": "price",
}
//屬性2
var arr2 = {
"7": {
"8": [
"4"
],
"9": [
"10"
]
},
"1": {
"2": [
"4",
"5"
],
"3": [
"6"
]
}
}
//倉庫
var arr3 = {
"4": {
"qty": "5",
"html": "
Warehouse1
"
},
"5": {
"qty": "6",
"html": "
Warehouse2
"
},
"6": {
"qty": "22",
"html": "
Warehouse3
"
},
"10": {
"qty": "13",
"html": "
Warehouse4
"
}
}
<dl>
<dt>
<label>屬性1</label>
</dt>
<dd>
<select name="super_attribute[1]" id="attribute1">
<option value="">Choose an Option...</option>
<option value="2">0.04Ohm</option>
<option value="3">0.05Ohm</option>
</select>
</dd>
<dt>
<label>屬性2</label>
</dt>
<dd>
<select name="super_attribute[7]" id="attribute7">
<option value="">Choose an Option...</option>
<option value="8">Black</option>
<option value="9">Red</option>
</select>
</dd>
<dt>
<label>Warehouse</label>
</dt>
<dd>
<!--根據(jù)上面選擇的屬性值顯示對應(yīng)的倉庫內(nèi)容-->
</dd>
</dl>
<dl>
<dt>
<label>屬性1</label>
</dt>
<dd>
<select name="super_attribute[1]" id="attribute1">
<option value="">Choose an Option...</option>
<option value="2">0.04Ohm</option>
<option value="3">0.05Ohm</option>
</select>
</dd>
<dt>
<label>屬性2</label>
</dt>
<dd>
<select name="super_attribute[7]" id="attribute7">
<option value="">Choose an Option...</option>
<option value="8">Black</option>
<option value="9">Red</option>
</select>
</dd>
<dt>
<label>Warehouse</label>
</dt>
<dd>
<!--根據(jù)上面選擇的屬性值顯示對應(yīng)的倉庫內(nèi)容-->
</dd>
</dl>