HTML DOM id ÊôÐÔ

¶¨ÒåºÍÓ÷¨

id ÊôÐÔÉèÖûò·µ»Ø 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>
VUE