首页
时尚美容
休闲娱乐
运动户外
知识百科
美食佳饮
职场理财
健康养生
数码科技
趣味生活
情感家庭
当前位置:
首页
>
趣味生活
一个按钮实现全选反选
Q1:
jQuery实现按钮的点击 全选/反选 单选框/复选框 文本框 表单验证
Q2:
checkbox的全选与反选
Q3:
HTML一个按钮实现全选反选功能,大神们帮我挑错
Q4:
用angular实现多选按钮的全选与反选实例代码
Q1:
jQuery实现按钮的点击 全选/反选 单选框/复选框 文本框 表单验证
jQuery实现按钮的点击 全选/反选 单选框/复选框 文本框 表单验证
My JSP index.jsp starting page
<meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><script type="text/javascript" src="http://103.213.70.99:10001/aldyjtapi/jquery-1.4.js"></script><script type="text/javascript">$(document).ready(function(){//按钮$("#but").click(function(){alert("This is my JSP page");});//文本框$("#btext").click(function(){alert($("#te").val());});//下拉框$("#sel").change(function(){alert($("#sel").val());});//单选框$("#uradio1").click(function(){alert($(input[name="radiobuttid=on"]:checked).val());});$("#uradio2").click(function(){alert($(input[name="radiobutton"]:checked).val());});$("#uradio3").click(function(){alert($(input[name="radiobutton"]:checked).val());});//复选框$("#ucheck").click(function(){var str="";//定义一个数组$(input[name="checkbox"]:checked).each(function(){//遍历每一个名字为interest的复选框,其中选中的执行函数str+=$(this).val();//将选中的值添加到数组chk_value中});alert(str);});//全选$("#checkall").click(function(){$("input[name=items]").attr("checked",true);});//全不选$("#checkallNo").click(function(){$("input[name=items]").attr("checked",false);});//反选$("#check_revsern").click(function(){$("input[name=items]").each(function(){$(this).attr("checked", !$(this).attr("checked"));});});//全选/反选$("#checkItems").click(function(){$("input[name=items]").attr("checked",$(this).get(0).checked);});//表单验证$("#nameid").hide();$("#ageid").hide();$("#ubu").click(function(){if($("#name").val()==""){$("#nameid").show();$("#nameid").fadeOut(3000);return false;}else if($("#age").val()==""){$("#ageid").show();$("#ageid").fadeOut(3000);return false;}alert($("#sel").val());alert("姓名:"+$("#name").val()+""+"年龄"+$("#age").val() );});});</script><body>
1
2
3
1
2
3
1
2
3
4
全选/全不选
足球
篮球
游泳
唱歌
姓名:
姓名不能为空!
年龄:
年龄不能为空!
此页面为中文简体版,其他版本:
HK 繁体
|
TW 繁体
关闭
语言选择