select框的onchange()事件 隐藏与显示另一个Select框

<!DOCTYPE html>
<html>
    <head>
        
        <style>
        .addcss{
            width: 100px;
            height: 50px;
        }
        </style>
        
        
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    
    <select class="addcss"   id="aaa" onchange="show()">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
    </select>

此处style="display:none"为隐藏,block为显示 <select class="addcss" style="display:none" id="_select"> <option value="a">a</option> <option value="b">b</option> </select> </body> </html> <script type="text/javascript"> function show(){ var ss=document.getElementById("aaa").value; if (ss=="1") { document.getElementById('_select').style.display='block'; } else{ document.getElementById('_select').style.display='none'; } } </script>

 

posted @ 2018-10-31 11:12  Jacky森  阅读(4366)  评论(0编辑  收藏  举报