ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: HTML DOM id ÊôÐÔ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM id ÊôÐÔ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:1290 :: ::

Definition and Usage
¶¨ÒåÓëÓ÷¨

The id property sets or returns the id of the form.
idÊôÐÔ¿ÉÓÃÀ´ÉèÖûò·µ»Ø±íµ¥µÄid

Syntax Óï·¨

formObject.id=id


Example ¾ÙÀý

The following example shows two methods on how to return the id of the <form> element:
ÏÂÃæµÄ¾ÙÀý½«Ê¹ÓÃÁ½ÖÖ·½·¨À´·µ»Ø<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>


ÑÝÁ·

Get the id from a <form> element
µÃµ½<form>ÔªËØµÄid

ÆÀÂÛ (0) All