为了账号安全,请及时绑定邮箱和手机立即绑定

你好,请问这句话<option>a</option>里面,a的值怎么取?

你好,请问这句话<option>a</option>里面,a的值怎么取?

www说 2021-08-11 15:11:39
<select id="xl1" onchange="change()" ><option >第一</option><option>第二</option></select><select id="xl2" onchange="change()" ><option >第一</option><option>第二</option></select>如果只有选择id=xl1中的“第二”才能显示出来id=xl2中的<select>我改怎么做?我没分,我不过真是再这里卡住了,谢谢各位
查看完整描述

2 回答

?
慕慕森

TA贡献1856条经验 获得超17个赞

<script type="text/javascript">
(function() {
var xl1,xl2
window.onload = function() {
xl1 = document.getElementById("xl1");
xl2 = document.getElementById("xl2");

xl1.onchange = xl2.onchange = change;
showItem(xl2, xl1.selectedIndex === 1);
};

function change(e) {
var e = e || window.event;
if( this === xl1 ) {
var b = this.selectedIndex === 1;
showItem(xl2, b)
}
}
function showItem(el, b) {
el.style.visibility = b?"visible":"hidden";
}
})();
</script>



查看完整回答
反对 回复 2021-08-16
  • 2 回答
  • 0 关注
  • 176 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信