Skip to content

Instantly share code, notes, and snippets.

@robertsky123
Forked from rwaldron/iframe-document.js
Last active December 16, 2015 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertsky123/5384994 to your computer and use it in GitHub Desktop.
Save robertsky123/5384994 to your computer and use it in GitHub Desktop.
获取iframe中的函数和元素
var iframe = document.getElementById("my-iframe"),
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).myfunction();//访问函数
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;//访问dom结构
console.log( iframeDoc );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment