zoukankan      html  css  js  c++  java
  • js

    //引入jquery 框架
    <script src="/style/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        //初始化-1
        $(document).ready(function() {     


       })
      //或者初始化-2
    jQuery(function(){


    })


    $.getScript("c.js");//引入js脚本
    </script> 


    //select option
        $('.cpLogo').change(function(){
            var url = $(this).children('option:selected').attr('data-url');
            var url2 = $('.cpLogo option:selected').attr('data-url');
            var val = $(this).val();
        })


    //checkbox 全选 & 取消全选
    $('#ckbAll').click(function(){
           $("input[name='ckbOption[]']").prop("checked",$(this).prop('checked'));
     })
    //验证checkbox 选中
    $("input[name='ckbOption[]']:checked").length;


    //radio 选中的值
     $("input[name='templet']:checked").val();
    //radio 赋值
    $("input[name='templet'][value=1]").prop("checked",true);


    //判断元素是否存在
    $('#id').length     或者  document.getElementById('id')


    //多个对象绑定单个事件
    $('#setupButton,#msgButton,#avatarButton').bind('click',function(){})


    //单个对象绑定多个事件
    $('#setupButton').bind('click mouseover',function(){})


    //serialize 表单提交
    $.post("i.php",$('#form').serialize(),function(data){ })
  • 相关阅读:
    排序入门练习题3 谁考了第k名 题解
    排序入门练习题2 从大到小排序 题解
    排序入门练习题1 排序 题解
    关于这个博客
    Count Good Substrings
    Long Long Message
    Milk Patterns
    Musical Theme
    Life Forms
    New Distinct Substrings
  • 原文地址:https://www.cnblogs.com/fonyer/p/8871439.html
Copyright © 2011-2022 走看看