• Jqurey学习笔记---1、jqurey简介


     

        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,那么也可以通过 CDN(内容分发网络) 引用它。

        谷歌和微软的服务器都存有 jQuery 。

        如需从谷歌或微软引用 jQuery,请使用以下代码之一:

        Google CDN:

        <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">
        </script>
        </head>

        提示:通过 Google CDN 来获得最新可用的版本:

        如果您观察上什么的 Google URL - 在 URL 中规定了 jQuery 版本 (1.8.0)。如果您希望使用最新版本的 jQuery,也可以从版本字符串的末尾(比如本例 1.8)删除一个数字,谷歌会返回 1.8 系列中最新的可用版本(1.8.0、1.8.1 等等),或者也可以只剩第一个数字,那么谷歌会返回 1 系列中最新的可用版本(从 1.1.0 到 1.9.9)。

        Microsoft CDN:

        <head>
        <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js">
        </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>

     

  • 相关阅读:
    qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
    使用 acl_cpp 的 HttpServlet 类及服务器框架编写WEB服务器程序(系列文章)
    C编译器剖析PDF文档及UCC编译器162.3
    深入浅出NodeJS——数据通信,NET模块运行机制
    看AngularJS
    如何编写高效的jQuery代码
    Express安装入门与模版引擎ejs
    使用SeaJS实现模块化JavaScript开发
    RequireJS 入门指南
    RequireJS
  • 原文地址:https://www.cnblogs.com/luwei-s/p/4223256.html
Copyright © 2020-2023  润新知