0
我在JavaScript中有一些函数f()创建一个iframe:如何调用iframe的功能,从这个IFRAME
var iframe = document.createElement("iframe");
$(iframe).attr({
width: 0,
height: 0,
frameborder: 0,
src: this.options.url,
name: id,
id: id
});
document.body.appendChild(iframe);
iframe.contentWindow.f = function(data) {
alert("test");
};
文档在这个iframe中加载应该调用函数f():
<script ...>f();</script>
而这在Firefox中完美运行,但Opera告诉,f()是未定义的。
有没有解决方法?
阿德里安。
你说得对。可能这就是原因。其实我打电话给家长的iframe功能,它的工作原理。这对我来说不是最好的解决方案,但很好理解,为什么self.f()在Opera中不起作用。感谢名单! – Adrian 2010-05-10 06:56:10