HTML DOM id Property
Complete IFrame Object Reference
Definition and Usage
The id property sets or returns the id of the iframe.
Syntax
Example
The following example shows two ways of how to return the id of the iframe:
<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>
|
Try-It-Yourself Demos
Return the
id from an <iframe> element
Complete IFrame Object Reference
|