【问题标题】:Flex get iframe text valueFlex 获取 iframe 文本值
【发布时间】:2012-06-26 09:42:44
【问题描述】:

我在我的 flex 应用程序上使用分层的 iframe。在我的 iframe 中,我有一个 id 为“days”的文本输入,它是只读的。

如何在我的 flex 应用中读取天数?

我想我可能需要做这样的事情?

var d = ExternalInterface.call("top.frames[0].document.getElementById('days').value");

但是没有用。

【问题讨论】:

  • 什么意思?你收到错误了吗?还是其他一些意想不到的结果?你如何显示 iFrame?您是否正在使用其中一个库来完成这项工作?还是别的什么?

标签: javascript actionscript-3 apache-flex iframe


【解决方案1】:

它不起作用,因为top.frames[0].document.getElementById('days').value 不是一个函数,它是一个属性。您需要将函数传递给ExternalInterface.call(更准确地说是函数的名称)。例如,您可以在 JavaScript(主窗口)中定义

top.GetValue = function(id) {
    return frames[0].document.getElementById(id).value;
}

然后使用

var d = ExternalInterface.call('top.GetValue', 'days');

在 ActionScript 中。

【讨论】:

    猜你喜欢
    • 2012-10-13
    • 2014-01-02
    • 2012-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-11
    • 1970-01-01
    • 2015-09-16
    相关资源
    最近更新 更多