HTML DOM id属性
定義と用法
id属性はiframeのidを設定または返します。
構文
iframeObject.id=id
例
この例では、iframeのidを返す2つの方法を示しています:
<html> <body> <iframe src="frame_a.htm" id="frame1"></iframe> <br /><br /> <script type="text/javascript"> document.write("The iframe's id: "); document.write(document.getElementsByTagName("iframe")[0].id
); document.write("<br /><br />"); document.write("別の方法: "); document.write("<br />"); document.write("The iframe's id: "); document.write(document.getElementById("frame1").id
); </script> </body> </html>