zoukankan      html  css  js  c++  java
  • JQuery学习(表单对象属性)---checked

     1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
     2 <%
     3     String path = request.getContextPath();
     4     String basePath = request.getScheme() + "://"
     5             + request.getServerName() + ":" + request.getServerPort()
     6             + path + "/";
     7 %>
     8 
     9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    10 <html>
    11 <head>
    12 <base href="<%=basePath%>">
    13 
    14 <title>My JSP 'jquery.jsp' starting page</title>
    15 
    16 <meta http-equiv="pragma" content="no-cache">
    17 <meta http-equiv="cache-control" content="no-cache">
    18 <meta http-equiv="expires" content="0">
    19 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    20 <meta http-equiv="description" content="This is my page">
    21 <script type="text/javascript" src="/common/easyui/jquery.min.js"></script>
    22 <script type="text/javascript">
    23     $(document).ready(function(){
    24     $("input:checked").attr("checked",false);//取消已选中的复选框
    25     });
    26     
    27 </script>
    28 
    29 </head>
    30 <body>
    31 <form>
    32 <form>
    33   <input type="checkbox" name="newsletter" checked="checked" value="Daily" />
    34   <input type="checkbox" name="newsletter" value="Weekly" />
    35   <input type="checkbox" name="newsletter" checked="checked" value="Monthly" />
    36 </form> 
    37 </form> 
    38 
    39 </body>
    40 </html>

            效果图1-1

    重点解释:

    $("input:checked"):查找所有选中的复选元素框
    注释:代码中取消勾选所有曾经选中的复选框。
     
  • 相关阅读:
    由少林寺比武想到软件行业分工
    微软SQL 报表服务的研究
    图形化窗体表单设计器
    多层数据源处理复杂数据结构
    Universal menu command handle pattern
    使用foreach来读取记录
    C#计算20902个汉字的拼音首字母
    软件的价值
    虚控件在GUI编程中的应用
    深刻的检讨书
  • 原文地址:https://www.cnblogs.com/2296bbs/p/5360975.html
Copyright © 2011-2022 走看看