You can use the DOM to access the objects in a Web page but often you want to just change one thing.  To do that give it an HTML id attribute and use the built in JavaScript method getElementById.  Open jsinline.html and save as jsget.html.  Delete the single line of code inside the function.

Copy the paragraph and paste it under itself.  Give both paragraphs an id attribute (use first and second as the id values).

Paste these lines inside the function:


Have a look at that code and guess what it will do.  Save it and try it.

The method getElementById looks inside the element it is attached to.  Here that is document.  It looks for a child element with an id that matches the parameter.  Then you are changing the properties for the style object for the matching element.  In English it might sound like this:

In the browser window find the document.  In the document use the method to find an element with an id of first.  Inside that is a style object (the inline styles).  Change the fontSize property for that object.