日期:2014-05-17  浏览次数:21074 次

选择下拉菜单中的某项,下面出现相应的table,100分求解
<table   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<form   name= "myform ">
            <tr>
                <td   height= "30 "   align= "right "   class= "blackw "> 类别: </td>
                <td   align= "left "     class= "register2 "> <select   name= "productSort ">
                    <option   value= "1 "   selected> 中餐 </option>
                    <option   value= "2 "> 西餐 </option> (当选择西餐时出现下面的table)
                            </select> </td>
                </tr>

<table   border= "0 "   cellspacing= "0 "   cellpadding= "0 "> (这个table是选西餐时要出现的)
                    <tr>
                          <td> &nbsp; </td>
                    </tr>
                  </table>

    </form>
        </table>

------解决方案--------------------
如果就只有选中某项的时候显示一个表格,javascript简单控制一下就行了
如果希望选中不同的项会显示不同的表格,那么ajax
------解决方案--------------------
<table border= "0 " cellspacing= "0 " cellpadding= "0 ">
<form name= "myform ">
<tr>
<td height= "30 " align= "right " class= "blackw "> 类别: </td>
<td align= "left " class= "register2 ">
<select name= "productSort " onChange= "return showTable() ">
<option value= "1 " selected> 中餐 </option>
<option value= "2 "> 西餐 </option>
</select> </td>
</tr>
<tr> <td>
<table id= "a " style= "display:none " border= "0 " cellspacing= "0 " cellpadding= "0 "> (这个table是选西餐时要出现的)
<tr>
<td> &nbsp; </td>
</tr>
</table> </td> </tr>
</form>
</table>
<script language= "javascript ">
function showTable(){
if(myform.productSort.value==2)
document.getElementById( "a ").style.display= " ";
else
document.getElementById( "a ").style.display= "none ";
}
</script>
------解决方案--------------------
<table border= "0 " cellspacing= "0 " cellpadding= "0 ">
<form name= "myform ">
<tr>
<td height= "30 " align= "right " class= "b