IFRAME动态加载触发onload事件(转)

原文地址:http://blog.ops.cc/webtech/javascript/f5nhm.html

<body>

    <script>var iframe = document.createElement("IFRAME");

        document.body.appendChild(iframe);

        iframe.src = "http://www.ops.cc";



        if (iframe.attachEvent) {

            iframe.attachEvent("onload", function () {

                alert("Local iframe is now loaded.");

            });

        } else {

            iframe.onload = function () {

                alert("Local iframe is now loaded.");

            };

        }

    </script>

</body>
原文地址:https://www.cnblogs.com/wangjunwei/p/4294243.html