HTML DOM id 屬性
定義和用法
id 屬性可設(shè)置或返回 checkbox 的 id。
語(yǔ)法
checkboxObject.id=id
實(shí)例
下面的例子可輸出 checkbox 的 id:
<html>
<body>
<form>
<input type="checkbox" id="check1" />
</form>
<p>The id of the checkbox is:
<script type="text/javascript">
document.write(document.getElementById("check1").id
)
</script>
</p>
</body>
</html>