HTML DOM id 屬性
定義和用法
id 屬性可設(shè)置或返回 <base> 元素的 id。
語法
baseObject.id=id
實(shí)例
下面的例子可返回 <base> 元素的 id:
<html>
<head>
<base id="myBaseId" href="http://www.dbjr.com.cn/htmldom/" />
</head>
<body>
<p>Base id:
<script type="text/javascript">
x=document.getElementsByTagName('base')[0];
document.write(x.id
);
</script>
</body>
</html>
輸出:
Base id: myBaseId