初学asp,做了一个提交的页面,想让提交的字段信息根据本页面的一个下拉select值不同而不同,有人提示我把页面分成不同div,然后根据select值显示、隐藏,希望有人能告诉我具体方法,谢谢
<form>
条件:
<select name="name" id="name">  
<option value="">请输入添加配件的编号</option>
</select>
条件1时显示:
<tr>
        <td align="right" height="30">故障现象1:</td>
        <td class="category"><input type="text" name="gzxx1" style="width:300px"></td>
</tr>
条件2时显示:
<tr>
        <td align="right" height="30">故障现象2:</td>
        <td class="category"><input type="text" name="gzxx2" style="width:300px"></td>
</tr>
</form>

解决方案 »

  1.   


    <html>
    <head>
    <title></title>
    <script>
    function openBg()
    {
    var a = document.getElementById("SelectName").value;
    if(a == 1)
    {
    document.getElementById("c00").style.display="block";
    document.getElementById("c01").style.display="none";
    }
    if(a == 2)
    {
    document.getElementById("c00").style.display="none";
    document.getElementById("c01").style.display="block";
    }
    }
    function onload()
    {
    document.getElementById("c00").style.display="none";
    document.getElementById("c01").style.display="none";
    }
    </script>
    </head>
    <body onload="onload()">
    <select name="SelectName" onchange="openBg()" style="margin-bottom: 30px;">
    <option value="">
    请选择
    </option>
    <option value="1">
    1
    </option>
    <option value="2">
    2
    </option>
    </select>
    <div id="c00">
    <!-- 读取数据库中的数据 -->
    <input type="radio" name="" value="北京" />
    北京
    <input type="radio" name="" value="福建" />
    福建
    </div>
    <div id="c01">
    <!-- 读取数据库中的数据 -->
    <input type="radio" name="" value="上海" />
    上海
    <input type="radio" name="" value="江苏" />
    江苏
    </div>
    </body>
    </html>