日期:2014-05-16  浏览次数:20429 次

EXTJS中如何在外部调用函数
比如有一段代码在一个frame里边

Ext.onReady(function() {
  var login=function(){
  //login
  };
});

那能否在外部调用这个login函数呢

比如像全局函数一样在浏览器地址栏中执行:javascript:login();

或者类似的方法,如果能在webbrowser控件中执行就最好了

------解决方案--------------------
应该可以调用的吧, 外面没有定义login,并且 onReady 执行完毕后
oIE.Document.frames("f_name").login()

------解决方案--------------------
IE8下通过

iframe.htm

HTML code
<html>
<head>
<title>1231</title>
</head>
<body>
<iframe id="left" src="left.html"></iframe>
<input type="button" value="按我" onclick="show()"/>
<script>

show = function(){
    alert(document.getElementById("left").contentWindow.a)
}
</script>
</body>
</html>