火狐中异步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>
原文地址:https://www.cnblogs.com/mxw09/p/1884750.html