-
-
Save MoChiwaki/c5150493d73ac59354a3 to your computer and use it in GitHub Desktop.
iframeのサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iframeの枠を作る | |
document.write('<iframe id="frame" name="frame" onload="test()" width="300" height="350"></iframe>'); | |
// iframeの中身を作る | |
function test(){ | |
var frame = document.getElementById("frame"); | |
frame.contentDocument.write('<a href="http://jsfiddle.net/MoChiwaki/uhhkxsd6/32/embedded/result%2Chtml%2Cjs%2Ccss/#Result" target="_top"><img src="http://cdn1.www.st-hatena.com/users/Mo/MoChiwaki/profile.gif" /></a>'); | |
} | |
// iframeの中のaタグだけ取る | |
function check(){ | |
var iframesrc = document.getElementsByTagName("iframe")[0].contentDocument.getElementsByTagName("a"); | |
return iframesrc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment