Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.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 HTML复选框值仅返回';在';_Javascript_Python_Html_Css - Fatal编程技术网

Javascript HTML复选框值仅返回';在';

Javascript HTML复选框值仅返回';在';,javascript,python,html,css,Javascript,Python,Html,Css,html javascript .subCats { display: none; margin-left: 20px; } .sub { display: none; margin-left: 20px; } 单击提交按钮时, 性别和类别名称[]返回正确的值。 例如,性别=F&age=on&category_name=b 但年龄值只是返回“on”。即使设置复选框的值,也只返回“on”。 问题是什

html

javascript

    .subCats {
        display: none;
        margin-left: 20px;
    }

    .sub {
        display: none;
        margin-left: 20px;
    }
单击提交按钮时,
性别和类别名称[]返回正确的值。
例如,性别=F&age=on&category_name=b 但年龄值只是返回“on”。即使设置复选框的值,也只返回“on”。 问题是什么。。?javascript代码有错吗


这是一个输入错误,年龄输入中属性“value”的拼写不正确,因此未指定年龄标记的值

选中复选框时,将“on”用作其默认值,这就是为什么将“on”作为值

替换

 function toggleShow(checkbox) {
        var id = 'subCats' + checkbox.id;
        var subCats =
            document.all ? document.all[id] :
                document.getElementById ? document.getElementById(id) :
                    null;
        if (subCats) {
            if (subCats.style.display == '' ||
                subCats.style.display == 'none')
                subCats.style.display = 'block';
            else
                subCats.style.display = 'none';
        }
    }
    function toggleShow2(checkbox) {
        var id = 'sub' + checkbox.id;
        var sub =
            document.all ? document.all[id] :
                document.getElementById ? document.getElementById(id) :
                    null;
        if (sub) {
            if (sub.style.display == '' ||
                sub.style.display == 'none')
                sub.style.display = 'block';
            else
                sub.style.display = 'none';
        }
    }



当问题中没有一行python代码时,为什么要使用
python
django
标记?我修改了标记。非常感谢。
 function toggleShow(checkbox) {
        var id = 'subCats' + checkbox.id;
        var subCats =
            document.all ? document.all[id] :
                document.getElementById ? document.getElementById(id) :
                    null;
        if (subCats) {
            if (subCats.style.display == '' ||
                subCats.style.display == 'none')
                subCats.style.display = 'block';
            else
                subCats.style.display = 'none';
        }
    }
    function toggleShow2(checkbox) {
        var id = 'sub' + checkbox.id;
        var sub =
            document.all ? document.all[id] :
                document.getElementById ? document.getElementById(id) :
                    null;
        if (sub) {
            if (sub.style.display == '' ||
                sub.style.display == 'none')
                sub.style.display = 'block';
            else
                sub.style.display = 'none';
        }
    }
<INPUT TYPE="checkbox" NAME="age" ONCLICK="toggleShow2(this)" vaule='10' id='10'>
<INPUT TYPE="checkbox" NAME="age" ONCLICK="toggleShow2(this)" value='10' id='10'>