zoukankan      html  css  js  c++  java
  • jquery_2

    1.bind()
    bingding event handlers
    like:$("div").bind("click",function(){alert("the div is clicked!");});

    2.unbind()
    unbinding the event handler;
    like:$("div").unbind("click");

    3.event.type,target,pageX,pageY
    show the event attributes;
    like:$("div").bind("click",function(event){
    alert("Event type:" + event.types);
    alert("Event pageX:" + event.pageX);
    alert("Event pageY:" + event.pageY);
    alert("Event taget innerHTML:" + event.target.innerHTML);
    });

    4.click(),blur();
    also,we can bind the click or blur method directly use the two above functions;
    like:$("div").click(function(){alert("I was clicked!");});

    5.load(URL[,data][,callback_function])
    we use this fucntion load to achieve the AJAX:load a file to a selector;
    like:$("div").load("/jquery/result.html");

    6.getJSON(URL[,data][,callback_funciton]);
    we use this function to get JSON file and we can parse it to a JSON object;
    like:$("div").click(function(){
    $.getJSON("/jquery/result.json",function(jd){
    $("div").html("<p>Name:" + jd.name + "</p>");
    $("div").html("<p>Age:" + jd.age + "</p>");
    $("div").html("<p>Sex:" + jd.sex + "</p>");
    });
    });

    7.ajaxComplete(callback_function),ajaxStart(callback_function)
    we use those function work finish or before the ajax works;

    8.show(speed,callback),hide(speed,callback)
    use this to show the selector;
    like:$("#mydiv").show("slow",function(){alert(show finished!);});

    9.toggle(speed,callback)
    the function toggle achieves both show and hide;

    10.fadeIn(speed,callback);fadeOut(speed,callback);
    works just like the show and hide but with an effect of fade;

  • 相关阅读:
    MySQL和B树的那些事
    记一次临时抱佛脚的性能压测经历
    zookeeper api
    zookeeper笔记
    Mysql优化系列(1)--Innodb重要参数优化
    搞懂MySQL InnoDB B+树索引
    我以为我对Mysql索引很了解,直到我遇到了阿里的面试官
    HDFS原理概念扫盲
    设计原则
    设计模式 6大则
  • 原文地址:https://www.cnblogs.com/zengneng/p/5539990.html
Copyright © 2011-2022 走看看