Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.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
Jquery或语法中的逻辑错误?_Jquery_Html - Fatal编程技术网

Jquery或语法中的逻辑错误?

Jquery或语法中的逻辑错误?,jquery,html,Jquery,Html,单击收音机的其中一个选项是显示相同数量的选项日期,更改相应表格的显示或不显示,但这不会发生。您在逻辑或语法上有错误吗 <style> #ch2 ,#ch3 ,#ch4 ,#ch5 ,#ch6 ,#ch7 ,#ch8 ,#ch9 ,#ch10 ,#ch11 ,#ch12{ display: none; } </style> <script type="text/javascript" src="jquery

单击收音机的其中一个选项是显示相同数量的选项日期,更改相应表格的显示或不显示,但这不会发生。您在逻辑或语法上有错误吗

<style>
  #ch2   ,#ch3   ,#ch4   ,#ch5   ,#ch6   ,#ch7   ,#ch8   ,#ch9   ,#ch10  ,#ch11  ,#ch12{
        display: none;
  }

</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
        $("input[type=radio]").change(function(){
                var valor = $(this).val();
                for(i=1;i<=valor;i++){
                        $('#ch'+i).css("display","");
                }
                for(j=1;i<=12;i++){
                        $('#ch'+i).css("display","none");
                }

        })
});
</script>
<form name="senddata" method="post" action="">
        <table width="100%" border="0" id="radios" style="display: none">
        <tr>
                <td><label><input type="radio" name="parcelas" value="1" />1X</label></td>
                <td><label><input type="radio" name="parcelas" value="2" />2X</label></td>
                <td><label><input type="radio" name="parcelas" value="3" />3X</label></td>
                <td><label><input type="radio" name="parcelas" value="4" />4X</label></td>
                <td><label><input type="radio" name="parcelas" value="5" />5X</label></td>
                <td><label><input type="radio" name="parcelas" value="6" />6X</label></td>
                <td><label><input type="radio" name="parcelas" value="7" />7X</label></td>
                <td><label><input type="radio" name="parcelas" value="8" />8X</label></td>
                <td><label><input type="radio" name="parcelas" value="9" />9X</label></td>
                <td><label><input type="radio" name="parcelas" value="10" />10X</label></td>
                <td><label><input type="radio" name="parcelas" value="11" />11X</label></td>
                <td><label><input type="radio" name="parcelas" value="12" />12X</label></td>
        </tr>
        </table>
        <table width="100%" border="0" id="ch1">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data1"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch2">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data2"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch3">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data3"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch4">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data4"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch5">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data5"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch6">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data6"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch7">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data7"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch8">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data8"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch9">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data9"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch10">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data10"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch11">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data11"/></td>                
        </tr>
        </table>
        <table width="100%" border="0" id="ch12">
        <tr>
                <td>Data<br /><input name="input" type="text" name="data12"/></td>                
        </tr>
        </table>
</form>

#ch2、ch3、ch4、ch5、ch6、ch7、ch8、ch9、ch10、ch11、ch12{
显示:无;
}
$(函数(){
$(“输入[type=radio]”)。更改(函数(){
var valor=$(this.val();

对于(i=1;i
for(i=1;i只需指定一个值,而不是空值):

$('#ch'+i).css("display","table");

这应该可以解决问题,试穿一下。

看看你的样式表——你知道这就是类的用途,对吧?你问我们是否有语法错误?浏览器有一个控制台可以显示这些内容(例如firefox/chrome中的shift-ctrl-J)。您应该自己检查。您正在将数字
i
与字符串
valor
进行比较。将其转换为数字。在第二个
for
循环中,您应该使用
j
而不是
i
for(var j=1;j@VisioN…或
i
而不是
j
display
不应该设置为
block
inline
而不是空字符串吗?
$('#ch'+i).css("display","table");