zoukankan      html  css  js  c++  java
  • 学习 jQuery 2 document 对象的 ready 事件

     

    首先让我们实现 Helloworld。当网页加载之后,显示一个提示框,内容为 Hello, world

    在文档载入后,马上执行代码,可以通过 document 对象的 ready 事件来完成。

    取得 document 对象的方法非常简单,$( document ),如下就可以取得document 对象的 ready 事件 $( document ).ready

    让我们完成它。这个页面在文档载入之后会弹出一个对话框,并显示Hello, world

    <html>

             <head>

                       <title>Hello</title>

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

    <script type="text/javascript">

    $(document).ready( function() {

                                                   alert( "Hello, world." );

    } );

    </script>

             /head>

             </body>

             </body>

    </html>

    由于 document 对象的 ready 事件非常常用,它还可以简化为 $(   ),上述代码也可以如下完成。

    <html>

             <head>

                       <title>Hello</title>

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

    <script type="text/javascript">

    $( function() {

                                                   alert( "Hello, world." );

    } );

    </script>

             /head>

             </body>

             </body>

    </html>

  • 相关阅读:
    苏宁易购积分规则
    购物车的实现原理
    <mvc:annotation-driven />讲解
    c3p0、dbcp和proxool比较
    Spring的事务到底该给Dao配置还是给Service配置?
    Spring PropertyPlaceholderConfigurer占位符用法
    Spring <context:annotation-config />讲解
    DispatcherServlet讲解
    Spring3.1新特性
    Spring MVC入门
  • 原文地址:https://www.cnblogs.com/haogj/p/1232090.html
Copyright © 2011-2022 走看看