<table id="tableid"><tr><td>fdsfs</td></tr></table>
<select id="selectid" name="selectname" onchange="ShowandHide();">
<option value="1">show</option>
<option value="0">hide</option>
</select><SCRIPT LANGUAGE="JavaScript">
function ShowandHide()
{  
var Type=document.getElementById('selectid')
if(Type.options[Type.selectedIndex].value == 1)
{
                  javascript:document.getElementById('tableid').style.display='inline';
}
else
{
javascript:document.getElementById('tableid').style.display='none';
}
}</script>

解决方案 »

  1.   


    var Type=document.getElementsById('selectid')//getElementById,多了一个s
     javascript:document.getElementById('tableid').style.display='inline';//没这样用过;
    i == 1//i是什么?
    <SCRIPT LANGUAGE="JavaScript">
    function ShowandHide()
    {
    var Type=document.getElementById('selectid').value;if(Type == '1')
    {
    document.getElementById('tableid').style.display='inline';
    }
    else
    {
    document.getElementById('tableid').style.display='none';
    }
    }</script>
    </HEAD><BODY>
    <select id="selectid" name="selectname" onchange="ShowandHide();">
    <option value="1">show</option>
    <option value="0">hide</option>
    <TABLE id="tableid" border="1">
    <TR>
    <TD>asdfasd</TD>
    <TD>asdfasd</TD>
    </TR>
    <TR>
    <TD>asdfasd</TD>
    <TD>asdfasdf</TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>