我想要做的是让图像在选择时出现。例如,如果我选择第一个下拉菜单“iPhone 5S”,就会出现 iPhone 5S 的图像。然后第二个下拉菜单,当我选择“全局 - iPhone 5S”时,会出现一个不同的图像 - 但第一个仍然存在。所以本质上,我在问如何根据不同的选择使 2 个不同的图像出现?这让我很生气,而且我对 HTML 或 JS 都不是很擅长。请帮忙。谢谢。
<script type="text/javascript">
var firmwares = {};
firmwares[1] = {"7.0.2 (Global - iPhone 5S)" :"http://www.abc.com",
"7.0.2 (GSM - iPhone 5S)" :"http://www.abc.com",
"7.0.1 (Global - iPhone 5S)" :"http://www.abc.com",
"7.0.1 (GSM - iPhone 5S)" :"http://www.abc.com",};
firmwares[2] = {"7.0.2 (Global - iPhone 5C)" :"http://www.abc.com",
"7.0.2 (GSM - iPhone 5C)" :"http://www.abc.com",
"7.0.1 (Global - iPhone 5C)" :"http://www.abc.com",
"7.0.1 (GSM - iPhone 5C)" :"http://www.abc.com",};
function fillSelect(inX,inY){
inY.options.length = 1;
var curr = firmwares[inX];
for (each in curr)
{var nOption = document.createElement('option');
nOption.appendChild(document.createTextNode(each));
nOption.setAttribute("value",each);
inY.appendChild(nOption);}
document.getElementById("gotoLink") = "none";}
function openLink(inA, inB) {
var gotoLink = document.getElementById("GotoLink");
gotoLink.href = firmwares[inA][inB];}
</script>
<body>
<form name="container" method="post" action="">
<div>
<select name="phones" style="position: absolute; top: 15px; left: 12px;" onchange="fillSelect(this.value,this.form['firmwares'])">
<option value=""><Select iOS Device></option>
<option value="1">iPhone 5S</option>
<option value="2">iPhone 5C</option>
</select>
<select name='firmwares' style="position: absolute; top: 15px; left: 533px;" onchange="openLink(this.form['phones'].value, this.value)" >
<option value=""><Select iOS Firmware></option>
</select>
<button style="position: absolute; top: 375px; left: 750px;"><a id="GotoLink" href="#">Download Firmware</href></button>
</div>
</form>
</body>