简体   繁体   中英

Flex get iframe text value

I am using an iframe layered over my flex application. In my iframe i have a text input with the id of 'days' which is read only.

How can i read the value of days in my flex app?

I thought i may need to do something like this?

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

but it didn't work.

It doesn't work, because top.frames[0].document.getElementById('days').value is not a function, it's a property. You need to pass function to ExternalInterface.call (more precisely the name of a function). For example, you can define in JavaScript (main window)

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

and then use

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

in ActionScript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM