1

我正在使用 jQuery colorbox 并将 HTML 加载到 iframe 中。一切正常。在 iframe 加载时,我想显示一条“待在页面正在加载”的消息

我尝试使用回调接口......如果我使用在加载/打开事件之前发送警报的传统示例,它可以正常工作。如果我尝试使用 document.write 来显示消息,我会看到消息但 iframe 不会加载。

            //Examples of how to assign the ColorBox event to elements
            $(".iframe").colorbox({
                                            iframe:true, width:"80%", height:"80%",
                                           onOpen:function(){document.write("fff"); }

                                });

我究竟做错了什么?

4

1 回答 1

1

document.write()页面加载后请勿使用。如果这样做,它将完全停止文档的内容。事实上,根本不要使用document.write().

如果您需要比alert()测试和调试更好的东西(您确实需要),请使用console.log().

于 2012-08-22T21:29:57.747 回答