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>