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;

  • 相关阅读:
    基于jQuery的上下无缝滚动应用(单行或多行)
    表单验证
    中国剩余定理 ( 的学习 )
    扩展欧几里德算法--学习笔记
    Vijos P1794 文化之旅
    1336 : Matrix Sum (hihocoder)
    nyoj 1030 hihocoder 1338
    多重邻接表
    图的存储 ( 十字链表 )
    01背包的变形
  • 原文地址:https://www.cnblogs.com/zengneng/p/5539990.html
Copyright © 2011-2022 走看看