input:checkbox多选框实现单选效果跟radio一样
废话不多说,直接代码:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<scriptsrc="js/jquery-1.8.3.min.js"type="text/javascript"language="javascript"></script>
<title>无标题文档</title>
<scripttype="text/javascript">
$(function(){
$(":checkbox").click(function(){
if($(this).attr("checked")!=undefined)
{
$(this).siblings().attr("checked",false);
$(this).attr("checked",true);
}
});
});
</script>
<style>
span,input{float:left;}
input{width:14px;height:14px;}
span{margin-right:20px;}
</style>
</head>
<body>
<div>
<inputtype="checkbox"/><span>1</span>
<inputtype="checkbox"/><span>2</span>
<inputtype="checkbox"/><span>3</span>
<inputtype="checkbox"/><span>4</span>
<inputtype="checkbox"/><span>5</span>
<inputtype="checkbox"/><span>6</span>
<inputtype="text"/><span>7</span>
</div>
</body>
</html>
热门推荐
10 香港老妈结婚祝福语简短
11 毕业立体贺卡祝福语简短
12 简短新年年会祝福语
13 评论小品祝福语大全简短
14 恭喜师兄结婚祝福语简短
15 员工集体辞职祝福语简短
16 高中新生祝福语 简短
17 装修祝福语男生搞笑简短
18 生日开业蛋糕祝福语简短