zoukankan      html  css  js  c++  java
  • 松软科技Web课堂:jQuery 简介

    jQuery 库 - 特性

    jQuery 是一个 JavaScript 函数库。

    jQuery 库包含以下特性:

    • HTML 元素选取
    • HTML 元素操作
    • CSS 操作
    • HTML 事件函数
    • JavaScript 特效和动画
    • HTML DOM 遍历和修改
    • AJAX
    • Utilities

    向您的页面添加 jQuery 库

    jQuery 库位于一个 JavaScript 文件中,其中包含了所有的 jQuery 函数。

    可以通过下面的标记把 jQuery 添加到网页中:

    <head>
    <script type="text/javascript" src="jquery.js"></script>
    </head>

    请注意,<script> 标签应该位于页面的 <head> 部分。

    基础 jQuery 实例

    下面的例子演示了 jQuery 的 hide() 函数,隐藏了 HTML 文档中所有的 <p> 元素。

    实例

    <html>
    <head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $("button").click(function(){
    $("p").hide();
    });
    });
    </script>
    </head>
    
    <body>
    <h2>This is a heading</h2>
    <p>This is a paragraph.</p>
    <p>This is another paragraph.</p>
    <button type="button">Click me</button>
    </body>
    </html>

    库的替代

    Google 和 Microsoft 对 jQuery 的支持都很好。

    如果您不愿意在自己的计算机上存放 jQuery 库,那么可以从 Google 或 Microsoft 加载 CDN jQuery 核心文件。

    使用 Google 的 CDN

    <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
    /jquery/1.4.0/jquery.min.js"></script>
    </head>

    使用 Microsoft 的 CDN

    <head>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery
    /jquery-1.4.min.js"></script>
    </head>

    ---------------------------------------------------文章来源:www.sysoft.net.cn,加v:15844800162深度交流-------------------------------------------------------------------

  • 相关阅读:
    原子操作--sync/atomic的用法
    基础的排序算法以及查找算法
    (三)MySQL终极篇
    (二)MySQL中级篇
    数据库表添加索引对性能的影响
    事务的四大特性以及事务的隔离级别
    int 和Integer
    数据库三范式
    Java反射
    获取Class实例的三种方式
  • 原文地址:https://www.cnblogs.com/sysoft/p/12169737.html
Copyright © 2011-2022 走看看