Javascript typeof fn==“函数”,但不支持fn()
不幸的是,我不得不处理一些涉及大量框架集操作的代码。我有一个帧通过jQuery AJAX将数据加载到另一个帧中,如下所示:Javascript typeof fn==“函数”,但不支持fn(),javascript,ajax,function,internet-explorer-8,frameset,Javascript,Ajax,Function,Internet Explorer 8,Frameset,不幸的是,我不得不处理一些涉及大量框架集操作的代码。我有一个帧通过jQuery AJAX将数据加载到另一个帧中,如下所示: var lookUpDiv = $("<span />", top.frames["Main"].document) .attr("id", "lookUpDiv") .css({ "background-color": "#ffffff", "margin": "10px", "overflow-y": "auto", "overflo
var lookUpDiv = $("<span />", top.frames["Main"].document)
.attr("id", "lookUpDiv")
.css({
"background-color": "#ffffff",
"margin": "10px",
"overflow-y": "auto",
"overflow-x": "hidden",
"max-height": "100%",
"display": (notIE8 ? "inline-block" : "inline"),
"text-align": "center",
"border-radius": "25px"
})
.text("Loading: Please Wait.")
.load("associateLookup-1.asp")
.appendTo(centeringDiv);
除了ie8之外,我尝试过的所有浏览器都可以使用它。不幸的是,我们的大多数客户都使用ie8,所以让它工作是绝对必须的。我进入js控制台,从测试中发现了一些有趣的结果:
top.frames["Main"].closePopup == {...}
typeof top.frames["Main"].closePopup == "function"
top.frames["Main"].closePopup()
"Object doesn't support this property or method"
有人知道我为什么不能调用这个函数吗?你在使用JQueryMigrate吗?没有,我没听说过。我会看一看,但现在我没有使用它。typeof top.frames[Main].closePopup==函数真吗?是的。如果我运行typeof top.frames[Main].closePopup==函数,它将返回true。
top.frames["Main"].closePopup == {...}
typeof top.frames["Main"].closePopup == "function"
top.frames["Main"].closePopup()
"Object doesn't support this property or method"