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>
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下