日期:2014-05-16 浏览次数:20441 次
<button type="button" class="active">点击我</button>
<input type="radio" style="display: none">
<input type="radio" style="display: none" check>
<button type="button" class="btn btn-warning btn-primary memtype active"
onclick='checkedRadio(this,"g_6");' data-toggle="button">企业</button>
<input type="radio" name="post[regid]" value="6" id="g_6" checked="true">
<button type="button" name="post[regid]" value="5" onclick='checkedRadio(this,"g_5");' class="btn btn-warning btn-primary memtype" data-toggle="button">个人</button>
<input type="radio" name="post[regid]" value="5" id="g_5">
<script type="text/javascript">
function checkedRadio(obj,_id){
var _cheched = hasClass(obj,'active');
if(!_cheched){
obj.className+=' active';
}
document.getElementById(_id).checked = true;
}
function hasClass(obj , _class){
var _classes = obj.className.split(' ');
for(var i in _classes){
if(_classes[i]==_class){
return true;
}
}
return false;
}
</script>