HTML DOM id ÊôÐÔ

¶¨ÒåºÍÓ÷¨

id ÊôÐÔ¿ÉÉèÖûò·µ»Ø°´Å¥µÄ id¡£

Óï·¨

buttonObject.id=id

ʵÀý

ÏÂÃæµÄÀý×Ó¿É»ñÈ¡°´Å¥µÄ id£º

<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>
VUE