Accessing JavaScript variable in an iframe, from the parent window on same domain

from: stackoverflow, original:http://stackoverflow.com/questions/14366841/accessing-javascript-variable-in-an-iframe-from-the-parent-window-on-same-domai

You are already executing the script when the <iframe> is still loading, so it’s test is undefined. Either wait for the iframe’s load event, or just get the variable when clicking:

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注