JavaScript DHTML/Node Operation/id

Материал из Web эксперт
Перейти к: навигация, поиск

"id" Example

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript"> function getID(elem) {

  var id = elem.id;
  alert("This element"s id attribute is set to \"" + id + "\"."); 

} </script>

Click in the following image to display the id attribute"s value.

<img id="myImg"

    src="http://www.wbex.ru/style/logo.png" 
    alt="http://www.wbex.ru" 
    width="99" 
    height="78" 
    onclick="getID(this);">

</body> </html>


     </source>