我想链接我的HTML下拉菜单到我的表中有复选框。JavaScript链接下拉菜单复选框
此javascript函数试图看到如果“弧”值已被选择,则禁用该复选框3,其示出了光谱:
function showShields()
{
if (document.getElementById("Shield").value == ("arc")
{
document.getElementById("checkBox3").disabled=true;
}
}
这是HTML代码:
<!DOCTYPE html>
<html>
<head>
<script src="SpiritShield.js"></script>
</head>
<body>
<p>What kind of shield are you interested in?</p>
<select id="Shield">
<option value="arc">ARC</option>
<option value="divine">GAS</option>
<option value="spectral">MIG</option>
<option value="elysian">ANY</option>
</select>
</body>
<table border="2" cellspacing="0">
<tr>
<th>Checkbox</th>
<th>Shield</th>
</tr>
<tr>
<td><input type="checkbox" id="checkBox1"</td>
<td>ARC1</td>
</tr>
<tr>
<td><input type="checkbox" id="checkBox2"</td>
<td>ARC2</td>
</tr>
<tr>
<td><input type="checkbox" id="checkBox3"</td>
<td>SPECTRAL1</td>
</tr>
<tr>
<td><input type="checkbox" id="checkBox4"</td>
<td>SPECTRAL2</td>
</tr>
</table>
</html>
莫非
有人帮我解决这个问题?
谢谢
在HTML是无效的,有一些未封闭的标签。 –
嗯在哪里?另外我不认为这就是为什么我的javascript功能没有工作的原因:( – Gary
Muthu是正确的,你的/ body标签是你选择后,你应该把它移动到/ html之前的底部 – Sean