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>
系统帮助 | 给我留言 | 收藏本站
Copyright © 2005-2008 www.cnn84.com All Rights Reserved Ver:2.0
CNN84网是公益性便民网站,是为了给大家的日常生活查询及提供最快捷的出行指南