• prev + next选择器


    1、prev + next:匹配所有紧接在 prev 元素后的 next 元素

    2、(1)prev:任何有效选择器

          (2)next:一个有效选择器并且紧接着第一个选择器

    3、示例

    (1)源码如下

    prev.html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>prev + next选择器</title>
    <script type="text/javascript" src="jquery-2.0.3.js"></script>
    <style type="text/css">
        body{
    	   100%;
    	   height:100%;
    	   font-size:18px;
    	   text-align:center;
    	   background-color:#66FFFF;
    	   }
        .div_input{
    	   float:left;
    	   }
        .div_label{
    	   font-size:16px;
    	   font-weight:bold;
    	   }
    </style>
    <script type="text/javascript">
       $(function(){
           $(function(){
    	        //prev + next选择器的运用
    	       $("label + input").click(function(){
    		        alert("OK!"); 
    		   });
    	   });
       });
    </script>
    </head>
    
    <body>
       <form id="body_form">
          <div class="div_input"></div>
    	    <label class="div_label">请选择您的兴趣爱好:</label>
                <input type="checkbox" id="one" name="one" class="ckb"/>足球
    	    <input type="checkbox" id="two" name="two" class="ckb"/>篮球
    	    <input type="checkbox" id="three" name="three" class="ckb"/>网球
    	    <input type="checkbox" id="four" name="four" class="ckb"/>羽毛球
    	    <input type="checkbox" id="five" name="five" class="ckb"/>围棋
    	    <input type="checkbox" id="six" name="six" class="ckb"/>象棋
    	    <input type="checkbox" id="seven" name="seven" class="ckb"/>登山
    	    <input type="checkbox" id="eight" name="eight" class="ckb"/>阅读
          </div>
       </form>
    </body>
    </html>
    
    (2)选择第一个时,会弹出界面

              

    (3)选择后面选项(第一个除外),不会弹出提示窗口

              


  • 相关阅读:
    POJ 3667 & HDU 3308 & HDU 3397 线段树的区间合并
    HDU 5992 kd-tree
    BZOJ 4154 kd-tree dfs序 + 二维空间的区间(矩阵)更新单点查找
    BZOJ 4066 kd-tree 矩形询问求和
    BZOJ 1941 kd-tree
    BZOJ 2648 kd-tree模板
    HDU 5925 离散化
    php trait
    php命名空间
    js
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13315734.html
Copyright © 2020-2023  润新知