HTML DOM id 속성
정의 및 사용법
id 속성은 iframe의 id를 설정하거나 반환할 수 있습니다.
문법
iframeObject.id=id
예제
이 예제는 iframe의 id를 반환하는 두 가지 방법을 보여줍니다:
<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("An alternate way: "); document.write("<br />"); document.write("The iframe's id: "); document.write(document.getElementById("frame1").id
); </script> </body> </html>