Document Object Model 

 

Lonce Wyse

Communication & New Media

lonce.wyse@cnm.nus.sg

or "The DOM" 

The Document 

Think of the DOM as a "tree" of "nodes" corresponding to the HTML structure

<html>

    <head>
        <title> Example 0</title>
    </head>

    <body >
        Hello World!
    </body>

</html>

Document Object Model

 

document = {  "head" : ... },  

                           "body" :  { ... }  , 

                               

                            }

 

Every HTML page has a Document Object

This is OBJECT is just what we need to connect our JavaScript code to the HTML document

 "getElementByID"  :   function(...){...},

Scripts and  *Modules*

  • Best practices: JavaScript as seperate files
  • We'll load JavaScript code into our browser using an HTML <script> element that allows us to specify where to find the code.
<script defer type="text/javascript" 
        src="appscripts/main.js" >
</script>

BRoll

By lonce

BRoll

A brief overview of audio synthesis fundamentals, and how to create interactive audio on the Web.

  • 429