指定数量を選択したら、checkboxは選択できません.javascriptコードです.


3つを選んだら効果が見られます.
 
<script> 

function disableCheckBox() { 
var obj=document.getElementsByTagName("input") 
for(var i=0;i<obj.length;i++) 
{ 
if ( !obj[i].checked ) 
obj[i].disabled = true; 
} 
} 
function ableCheckBox() { 
var obj=document.getElementsByTagName("input") 
for(var i=0;i<obj.length;i++) 
obj[i].disabled = false; 
} 

function check() 
{ 
var obj=document.getElementsByTagName("input") 
var sun=0; 

for(var i=0;i<obj.length;i++) 
{ 
if(obj[i].type=="checkbox" && 
obj[i].checked) 
sun++; 

if( sun< 3 ) 
{ 
ableCheckBox(); 
//break; 
} 
else if(sun == 3 ) 
{ 
disableCheckBox(); 
event.srcElement.checked=true; 
break; 
} 
else if(sun > 3 ) 
{ 
event.srcElement.checked=false; 
break; 
} 
} 
} 
</script> 
<input type='checkbox' name='cate[]' 
value='102' onclick="check();">   <input 
type='checkbox' name='cate[]' value='103' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='104' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='105' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='106' 
onclick="check();">  /   <input 
type='checkbox' name='cate[]' value='107' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='108' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='109' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='110' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='111' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='112' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='113' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='114' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='115' 
onclick="check();">  /   <input 
type='checkbox' name='cate[]' value='116' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='117' 
onclick="check();">     <input 
type='checkbox' name='cate[]' value='118' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='119' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='120' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='121' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='122' 
onclick="check();">    <input 
type='checkbox' name='cate[]' value='123' 
onclick="check();">    <input 
type='checkbox' name='cate[]' value='124' 
onclick="check();">     <input 
type='checkbox' name='cate[]' value='125' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='126' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='127' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='128' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='129' 
onclick="check();">     <input 
type='checkbox' name='cate[]' value='130' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='131' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='132' 
onclick="check();">    <input 
type='checkbox' name='cate[]' value='133' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='134' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='135' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='136' 
onclick="check();">     <input 
type='checkbox' name='cate[]' value='137' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='138' 
onclick="check();">    <input 
type='checkbox' name='cate[]' value='139' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='140' 
onclick="check();">    <input 
type='checkbox' name='cate[]' value='141' 
onclick="check();">   <input 
type='checkbox' name='cate[]' value='142' 
onclick="check();">