JQuery

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    JQuery - Presentation Transcript

    1. Jiayun Zhou 2008.11.22 TWJUG
    2. JavaScript Library
    3. Query
    4. Database?
    5. SQL?
    6. Select...
    7. document.getElementById(\"id\")
    8. document.getElementById(\"id\") jQuery: $(\"#id\")
    9. The jQuery function $(...) = jQuery(...)
    10. document.getElementsByTagName (\"div\")
    11. document.getElementsByTagName (\"div\") jQuery: $(\"div\")
    12. <input name=\"mail\" type=\"text\" /> document.getElementsByName (\"mail\")
    13. <input name=\"mail\" type=\"text\" /> document.getElementsByName (\"mail\") jQuery: $(\"input[name='mail']\")
    14. <input name=\"mail\" type=\"text\" /> document.getElementsByName (\"mail\") jQuery: $(\"*[name='mail']\")
    15. The power of Selectors
    16. $(\"*[name='mail']\")
    17. $(...)
    18. jQuery Object
    19. All the magic
    20. Attributes API
    21. $(\"img\").attr(\"src\") $(\"img\").attr(\"src\", \"/new/icon.png\")
    22. Traversing API
    23. Manipulation API
    24. $(\"div\").html() $(\"div\").html(\"<span class='red'>Hello <b>World</b></span>\")
    25. CSS API
    26. $(\"div\").css(\"color\") $(\"div\").css(\"color\",\"red\")
    27. Events API
    28. $(\"p\").click(fn) $(\"p\").click(function() { // do something }); $(\"p\").click()
    29. Effects API
    30. $(\"p\").show() $(\"p\").hide()
    31. Ajax API
    32. $(\"p\").load( url, [data], [callback] ) $(\"p\").load(\"another.html\")
    33. Chaining
    34. $(\"a\").attr(\"href\", \"foo.html\").show().html(\"foo\");
    35. Ex. 1 – Mousedown
    36. $(document).ready(function(){ $(\"a\").mousedown( function() { $(this).click(function () { return false; }); goURL($(this).attr(\"href\")); }); });
    37. $(document).ready(function(){ $(\"a[target='middlearea']\").mousedown( function() { $(this).click(function () { return false; }); goIframeURL($(this).attr(\"href\")); }); });
    38. $(document).ready(function(){ $(\"a[target!='middlearea']\").mousedown( function() { $(this).click(function () { return false; }); goURL($(this).attr(\"href\")); }); });
    39. Try it yourself
    40. Demo 1
    41. Ex. 2 – Marquee
    42. $(document).ready(function(){ $.ajaxSetup({ cache: false }); setTimeout(\"loadInfo()\", 60000); setTimeout(\"loadMar()\", 60000); });
    43. function loadInfo() { $(\"#infoUL\").load(\"header.do?method=info\", null, infoCallback); } function loadMar() { $(\"#mar\").load(\"header.do?method=marquee\", null, marCallback); }
    44. function infoCallback(responseText, textStatus, XMLHttpRequest) { setTimeout(\"loadInfo()\", 60000); } function marCallback(responseText, textStatus, XMLHttpRequest) { setTimeout(\"loadMar()\", 60000); }
    45. Demo 2
    46. Ex. 3 – On Idle Action
    47. include.jsp $(document).ready(function(){ $(\"iframe\").load(function(){ $.cookie('lastAction', new Date().getTime()); }); });
    48. index.jsp $(document).ready(function(){ setTimeout(\"checkLastAction()\", 60000); });
    49. function checkLastAction() { var interval = new Date().getTime() - $.cookie('lastAction'); if (interval > (20 * 60 * 1000)) { $(\"iframe[name='bodyFrame']\") .attr(\"contentWindow\").location.href = $(\"iframe[name='bodyFrame']\").attr(\"src\"); $.cookie('lastAction', new Date().getTime()); } setTimeout(\"checkLastAction()\", 60000); }
    50. Thanks

    + kojilinkojilin, 2 years ago

    custom

    2012 views, 0 favs, 3 embeds more stats

    taiwan java user group
    JQuery

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 2012
      • 1996 on SlideShare
      • 16 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 50
    Most viewed embeds
    • 12 views on http://www.techiegyan.com
    • 2 views on http://192.168.10.100
    • 2 views on file://

    more

    All embeds
    • 12 views on http://www.techiegyan.com
    • 2 views on http://192.168.10.100
    • 2 views on file://

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags