HTML DOM id 屬性
定義和用法
id 屬性設(shè)置或返回 textarea 的 id。
語法
textareaObject.id=id
實例
本例獲取 textarea 的 id:
<html>
<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById('txt1').id
);
}
</script>
</head>
<body>
<textarea id="txt1">
Hello world....This is a textarea
</textarea>
<br />
<input type="button" onclick="alertId()" value="Alert ID" />
</body>
</html>