开发者

Calling Javascript function in child iframe node

开发者 https://www.devze.com 2023-03-08 10:05 出处:网络
How can I call a javaScript function present in a child <iframe> node from the parent? I am using jquery selector to select the correct iframe node but do not know how to call the function. Also

How can I call a javaScript function present in a child <iframe> node from the parent? I am using jquery selector to select the correct iframe node but do not know how to call the function. Also the desired iframe has been added dynamically using jquery.

For example, the iframe is

<iframe id="frameOne" src="http://form_one.html"><iframe>

I need to do something like this

$(#frameOne).submitList();

where submitList() is a fun开发者_如何学Goction in form_one.html.

Thanks.


document.getElementById('frameOne').contentWindow.submitList();

frameOne should be the ID of the frame!


As long as both of the URLs are in the same domain it should work.

If they are not, then you run into cross-domain issues

0

精彩评论

暂无评论...
验证码 换一张
取 消