HTML and CSS Reference
EXPLANATION ( CONTINUED )
This p element is also assigned attributes. The dir attribute with rtl means the text
will be displayed from the right side of the screen to the left, as would be used with
Arabic or Hebrew.
The getElementById() method uses the id of the first paragraph and returns a ref-
erence to it.
The first paragraph has a dir and style attribute. Using dir and style.fontSize , Java-
Script can get access to these attributes.
The second paragraph has also been assigned attributes. Using the dir and class-
name of the class that is used to style this paragraph. The className property can
also be assigned the name of a different class to change the style of the object. The
output is shown in Figure 15.11.
You can create new nodes, make a clone of an existing node, insert a new node before
an existing node, remove a node, or replace a node. All of this is possible because the
W3C DOM introduced methods to modify the DOM. Table 15.6 lists the DOM methods.
resource on how to modify the DOM, go to http://www.howtocreate.co.uk/tutorials/Java-