Search notes:

DOM example: document.getElementById

document.getElementById('xyz') returns the node in a document whose id attribute has the value xyz.
The returned object inherits from Element.
<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>document.getElementById</title>

<script type="text/JavaScript">

function main() { try {
   var elem = document.getElementById('out');

   elem.innerHTML = "typeof(elem) = " + typeof(elem);

 } catch(e) {alert (e);}
}


</script>

</head>
<body onload='main();'>

  <div id='out'></div>

</body>
</html>

Github repository about-Document-Object-Model, path: /Node/Document/getElementById.html

See also

document.getElementsByName('abc') returns an array of elements whose name attribute is abc.
document.getElementsByTagName('div') returns an array of the <div> elements in a HTML document.
DOM examples

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758207262, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/DOM/examples/Node/Document/getElementById(76): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78