一个下拉菜单onchange时javascript不按常理出牌问题
function showmore() {
ct=document.getElementById( "ct ").value;
El1=document.getElementById( "jc1 ");
El2=document.getElementById( "jc2 ");
if (ct = "显示 ") {
El1.style.display= " ";
El2.style.display= " ";
}
else
{
El1.style.display= "none ";
El2.style.display= "none ";
}
}
<select name= "ct " id= "ct " onchange= "javascript:showmore() ">
<option value= " " selected= "selected "> 请选择 </option>
<option value= "显示 "> 显示 </option>
<option value= "不显示 "> 不显示 </option>
</select>
<span id= "jc1 " style= "display:none "> 1111111111 </span>
<span id= "jc2 " style= "display:none "> 2222222222 </span>
页面加载后这个jc1和jc2里的内容确实不显示,但当做出选择,哪怕是选择了“不显示”,这里的内容都显示出来!谁能告诉我这个问题出在哪里呢?难道是javascript判断不出来汉字value的值????
------解决方案-------------------- <select id= "ct " name= "ct " onchange= "javascript:showmore() ">
<option selected= "selected " value= " "> 请选择 </option>
<option value= "显示 "> 显示 </option>
<option value= "不显示 "> 不显示 </option>
</select>
<span id= "jc1 " style= "display: none "> 1111111111 &l