在IE下想要隐藏下拉框中的某个选项,用CSS和js控制Display:none都没有生效,求指点。代码如下
<html><head><scripttype="text/javascript">functionremoveElement(){document.getElement...
<html>
<head>
<script type="text/javascript">
function removeElement()
{
document.getElementById("carrierOperatorOption1").style.display="none";
document.getElementById("carrierOperatorOption2").style.display="none";
}
</script>
</head>
<body>
<h1>This is a header</h1>
<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>
<input type="button" style="display:none" onclick="removeElement()" value="Do not display paragraph" />
<select name="carrierOperator" id="carrierOperator" class="timeipt" onchange="displayGPRS()">
<option value="0" id="carrierOperatorOption0">www</option>
<option value="1" style="display:none;" id="carrierOperatorOption1">www</option>
<option value="2" style="display:none;" id="carrierOperatorOption2">www</option>
<option value="3" id="carrierOperatorOption3">qqq</option>
</select><span class="tips"> </span><span class="tips max" id="GprsCarrierOperator"></span>
</body>
</html> 展开
<head>
<script type="text/javascript">
function removeElement()
{
document.getElementById("carrierOperatorOption1").style.display="none";
document.getElementById("carrierOperatorOption2").style.display="none";
}
</script>
</head>
<body>
<h1>This is a header</h1>
<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>
<input type="button" style="display:none" onclick="removeElement()" value="Do not display paragraph" />
<select name="carrierOperator" id="carrierOperator" class="timeipt" onchange="displayGPRS()">
<option value="0" id="carrierOperatorOption0">www</option>
<option value="1" style="display:none;" id="carrierOperatorOption1">www</option>
<option value="2" style="display:none;" id="carrierOperatorOption2">www</option>
<option value="3" id="carrierOperatorOption3">qqq</option>
</select><span class="tips"> </span><span class="tips max" id="GprsCarrierOperator"></span>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询