有什么方法可以调用函数并同时通过单击标签来保存单选按钮的效果?
示例(我需要通过单击单选按钮的标签来打开/关闭带有复选框的字段集)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 过渡//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http ://www.w3.org/1999/xhtml">
<head>
<title>点击标签</title>
<script src="/js/jquery-1.3.2.min.js" type="text/ javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
accordionOptions();
});function AccordionOptions(){
$("label.legend, label.childless").click( function(event){
var 对立 = $(".subtype").not($(this).next());
var el = $(this) ; contrasts.find(
"input:checked").attr('checked', false) ; contrasts.removeClass(
"expanded");
el.siblings("label").removeClass("expanded") ;
el.next(".subtype").toggleClass("expanded");
el.toggleClass("expanded");
});
}
</script>
<style type="text/css">
<!--
HTML { text-align: center}
BODY { background: #FFF; 颜色:#494949;字体:.813em/140% Arial、Helvetica、sans-serif;文本对齐:左;利润:4em自动;
宽度:240px}标签{显示:块;边距底部:.6em}
.subtype { display: none}
.expanded { display: block !important}
.label.expanded { /*样式化选定的字段集标题*/}
-->
</style>
</head><body>
<form action="" method="post">
<fieldset>
<label class="legend expand"><input name="rb_item" type="radio" value="" checked="checked" />项目 0100</label>
<fieldset class="subtype expand">
<label><input name="item01" type="checkbox" value="" />项目 0101</label>
<label><input name=" item01" type="checkbox" value="" />项目 0102</label>
</fieldset>
<label class="childless"><input name="rb_item" type="radio" value="" />项目0200</label>
<标签类="legend"><input name="rb_item" type="radio" value="" />Item 0300</label>
<fieldset class="subtype">
<label><input name="item03" type="checkbox" value="" />项目 0301</label>
<label><input name="item03" type="checkbox" value="" />Item 0302</label>
</fieldset>
<button type="submit">提交</button>
</fieldset>
</表格>
</正文>
</html>