HTML DOM id ÊôÐÔ

¶¨ÒåºÍÓ÷¨

id ÊôÐÔ¿ÉÉèÖûò·µ»Ø±íµ¥µÄ id¡£

Óï·¨

formObject.id=id

ʵÀý

ÏÂÃæµÄÀý×ÓչʾÁËÁ½ÖÖ·µ»Ø <form> ÔªËØµÄ id µÄ·½·¨£º

<html>
<body>

<form id="myForm">
Text: <input type="text" size="20" value="Hello World" />
</form>

<script type="text/javascript">
x=document.getElementsByTagName('form')[0];
document.write("Form id: " + x.id);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myForm').id);
</script>

</body>
</html>
VUE