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;

  • 相关阅读:
    while语句的使用
    Sql Server2008忘记sa登陆密码
    C# 读取Excel到DataTable两种方式对比
    读《太阳照常升起》-海明威
    年终总结-2019 混沌收获
    如何在调试状态下部署局域网网站
    HTML-文本标签
    HTML-表单
    HTML-入门
    正则表达式大全
  • 原文地址:https://www.cnblogs.com/zengneng/p/5539990.html
Copyright © 2011-2022 走看看