# iframe之間溝通 parent呼叫child網頁內的function ``` document.getElementById('iframe的ID').contentWindow.function名稱 ``` 反過來child呼叫parent網頁的function ``` parent.function名稱 ``` PS. 前提是parent和child需要解決跨域的問題,失敗會看到如下: :::danger Uncaught DOMException: Blocked a frame with origin "https://xxx" from accessing a cross-origin frame ::: 參考: [iframe父頁子頁呼叫函式](https://blog.wu-boy.com/2010/05/%E7%AD%86%E8%A8%98-iframe-%E7%88%B6%E9%A0%81%E5%AD%90%E9%A0%81%E5%91%BC%E5%8F%AB%E5%87%BD%E5%BC%8F-parent-call-function/) ###### tags: `教學`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up