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

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

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

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

HTML DOM idÊôÐÔ


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

Definition and Usage

The id property sets or returns the id of the button.

Syntax

buttonObject.id=id


Example

The following example gets the id of the button:

<html>

<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById("myButton").id)
}
</script>
</head>
<body>
<form>

<input type="button" value="Click me!" id="myButton"
onClick="alertId()" />
</form>
</body>
</html>


Try-It-Yourself Demos

Alert id, type, and value of a Button + disable button

ÆÀÂÛ (0) All