zoukankan      html  css  js  c++  java
  • 火狐中异步JS的发现

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head id="head">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>向上下左右不间断无缝滚动图片的效果(兼容火狐和IE)</title>
    <style type='text/css'>
        img{border:1px solid red;display:block;height:50px;50px;}    
    </style>
    <script type='text/javascript'>
        function WriteJS(src)
        {
            document.write("<script type=\"text/javascript\" src=\""+src+"\"><\/script>");
        }
        function AppendJS(src) {
                var script = document.createElement("script");
                script.type = "text/javascript";
                script.src = src;
                if (document.all) {
                    script.onreadystatechange = function() {
                        if (this.readyState == "loaded" || this.readyState == "complete") {
                            alert();

                            alert("loaded")

                        }
                    }
                } else {
        //在火狐中JS异步加载完成后出发的是onload事件
                script.onload = function() {
                    alert("loaded");
          //因为火狐中尽管是异步加载JS,也是所有JS加载完成以后才触发window的onload事件,所以可以在此处绑定onload事件
                    window.onload = function() {
                        alert($("#bd").html());
                    };
                }
                }
                document.getElementById('head').appendChild(script);

        }
        AppendJS("jquery-1.4.2.min.js");
        
        function Fun()
        {    
            $(function(){
                            alert(123)
                        })
            //window.onload=function(){alert(456)}
        }
         alert(99)//将此句代码放在此处,弹出99,单击确定后还得单击 alert("loaded");弹出的确定页面内容才会呈现
    </script>
    <script type="text/javascript">
       alert(99)//将此句代码放在此处,只要弹出99,单击确定,页面内容就会出现。
    </script>
    </head>
    <body id="bd">
        <div id="dd">
            <div><span><a onclick="Fun()">wqsdfdsfsdf</a></span></div>
        </div>
    </body>
    </html>
  • 相关阅读:
    【Spring实战】—— 16 基于JDBC持久化的事务管理
    【Spring实战】—— 15 Spring JDBC模板使用
    (转)Spring Boot(九):定时任务
    (转)Spring Boot(八):RabbitMQ 详解
    (转)Spring Boot(七):Mybatis 多数据源最简解决方案
    (转)Spring Boot(六):如何优雅的使用 Mybatis
    (转)Spring Boot(五):Spring Boot Jpa 的使用
    (转)Spring Boot(四):Thymeleaf 使用详解
    (转)Spring Boot(三):Spring Boot 中 Redis 的使用
    (转)Spring Boot(二):Web 综合开发
  • 原文地址:https://www.cnblogs.com/mxw09/p/1884750.html
Copyright © 2011-2022 走看看