HTML DOM id ÊôÐÔ

¶¨ÒåºÍÓ÷¨

id ÊôÐÔ¿ÉÉèÖûò·µ»ØÍ¼ÏñµÄ id¡£

Óï·¨

imageObject.id=id

ʵÀý

ÏÂÃæµÄÀý×Ó½«Í¨¹ýÁ½ÖÖ·½·¨À´·µ»ØÍ¼ÏñµÄ id£º

<html>
<body>
<img id="compman" src="compman.gif" alt="Computerman" />
<br />

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

</body>
</html>
VUE