Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 基于复选框选择显示和隐藏表格无效_Javascript_Html_Css - Fatal编程技术网

Javascript 基于复选框选择显示和隐藏表格无效

Javascript 基于复选框选择显示和隐藏表格无效,javascript,html,css,Javascript,Html,Css,我有一个测试代码块,通过它我试图显示一个基于复选框选择的表。操作正在运行,并且正在显示表格。唯一的问题是——没有边界。你能就我在这里做错了什么给我一些建议吗 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</tit

我有一个测试代码块,通过它我试图显示一个基于复选框选择的表。操作正在运行,并且正在显示表格。唯一的问题是——没有边界。你能就我在这里做错了什么给我一些建议吗

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <table border="1">
                    <tr>
                    <td style=min-width:50px></td>
                    <td style=min-width:50px>Retrofit</td>
                    <td style=min-width:50px><input style=min-width:50px id="retrofit" name="retrofit" type="checkbox" value="1" onchange="javascript:toggleOtherTextboxVisible()" /></td>

       </tr>
        </table>
        <table style="display:none" name="table" id ='table' border="1"/>
        <th>new</th>
        <th>newer</th>
        </table>    
</body>

    <script type="text/javascript">
    function toggleOtherTextboxVisible()
    {
        var check = document.getElementById('retrofit');
        if (check.checked) {
            document.getElementById('table').style.display. = 'block';
        }
        else
        {
            document.getElementById('table').style.display = 'none';
        }                
    }
</script>
</html>

JSP页面
改造
新的
更新的
函数toggleOtherTextboxVisible()
{
var check=document.getElementById('Reformation');
如果(勾选,勾选){
document.getElementById('table').style.display='block';
}
其他的
{
document.getElementById('table').style.display='none';
}                
}

我看到的第一个错误是,表的显示值不是“block”,而是“table”

因此,只需更改此行:

document.getElementById('table').style.display. = 'block';
致:


@arindrajit很高兴我能帮忙;)
document.getElementById('table').style.display. = 'table';