才可以做動作的程式
是之前張搞幫我寫的~~~~~lol
HTML
------------------------------------------------------------------------------------
<p id="size"><strong>Size</strong>
<label><input type="checkbox" value="1" name="size_type[]"/>11111</label>
<label><input type="checkbox" value="2" name="size_type[]"/>2222</label>
<label><input type="checkbox" value="3" name="size_type[]"/>333</label>
<label><input type="checkbox" value="4" name="size_type[]"/>444</label>
<label><input type="checkbox" value="5" name="size_type[]"/>55555</label>
<label><input type="checkbox" value="6" name="size_type[]"/>6666</label>
</p>
<p id="type"><strong>Type</strong>
<label><input type="checkbox" value="1" name="type_group[]"/>aaaa</label>
<label><input type="checkbox" value="2" name="type_group[]"/>bbbb</label>
<label><input type="checkbox" value="3" name="type_group[]"/>cccccc</label>
<label><input type="checkbox" value="4" name="type_group[]"/>ddddd</label>
</p>
------------------------------------------------------------------------------------<label><input type="checkbox" value="1" name="size_type[]"/>11111</label>
<label><input type="checkbox" value="2" name="size_type[]"/>2222</label>
<label><input type="checkbox" value="3" name="size_type[]"/>333</label>
<label><input type="checkbox" value="4" name="size_type[]"/>444</label>
<label><input type="checkbox" value="5" name="size_type[]"/>55555</label>
<label><input type="checkbox" value="6" name="size_type[]"/>6666</label>
</p>
<p id="type"><strong>Type</strong>
<label><input type="checkbox" value="1" name="type_group[]"/>aaaa</label>
<label><input type="checkbox" value="2" name="type_group[]"/>bbbb</label>
<label><input type="checkbox" value="3" name="type_group[]"/>cccccc</label>
<label><input type="checkbox" value="4" name="type_group[]"/>ddddd</label>
</p>
Javascirpt
------------------------------------------------------------------------------------
var c1 = $('#size input:checked').length;
var c2 = $('#type input:checked').length;
if(c1 > 0 && c2 > 0 ){
//do something
}
else
{
alert('please fill in the Size, Type at least one');
}
------------------------------------------------------------------------------------
var c2 = $('#type input:checked').length;
if(c1 > 0 && c2 > 0 ){
//do something
}
else
{
alert('please fill in the Size, Type at least one');
}
沒有留言:
發佈留言