checkbox模仿radio
<html><head><meta charset="UTF-8"><title>checkbox模拟radio</title><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script><script type="text/javascript">$(function(){$('form input[type=checkbox]').click(function(){ var checkboxs = $('form input[type=checkbox]'); checkboxs.each(function(){ $(this).attr('checked', false); }); $(this).attr('checked', true);}); });</script></head><body><form name="form1" id="form" method="post" action=""><input type="checkbox" name="a" /><input type="checkbox" name="b" /></form></body></html> ?用复选框模仿单选框实现效果,Jquery控制,
其中each()是获取全部的复选框,使他们成未选中状态,只有点击的这个复选框是选中状态。
?