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

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

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

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

HTML DOM idÊôÐÔ


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

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

The id property sets or returns the id of the body.
idÊôÐÔ¿ÉÉèÖûò·µ»ØbodyµÄid

Syntax
Óï·¨

bodyObject.id=id


Example
¾ÙÀý

The following example shows two methods on how to get the id of the <body> element:
ÈçºÎʹÓÃÁ½ÖÖ·½·¨À´µÃµ½<body>ÔªËØµÄid

<html>
<body id="myid">

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

</body>
</html>

Output:
Êä³ö

Body id: myid
An alternate way: myid


ÑÝÁ·

Return the id of the <body> element
·µ»Ø<body>ÔªËØµÄid

ÆÀÂÛ (0) All