Prev | Current Page 94 | Next

Larry Ullman

"Building a Web Site with Ajax: Visual QuickProject Guide"


5 The span is attached to
the paragraph, created as
employee.
Actual Name

??¦
employee = document.createElement(???p??™);
span = document.createElement(???span??™);
span.setAttribute(???class??™, ???name??™);
name_node = document.createTextNode(names[i].
firstChild.nodeValue);
span.appendChild(name_node);
employee.appendChild(span);
br = document.createElement(???br??™);
employee.appendChild(br);
6 A break element is added to the
paragraph so that the pieces to follow
will begin on the next line.
handle the name
116 enabling an Ajax search
handle the department
The department has a little more formatting. It starts with the word
Department with strong emphasis, followed by a colon and the actual
department. There??™s another break at the end.
1 Another element, of type strong, is created.
2 A text node with the value Department is created.
3 The text node is made a child of the strong node. This places
the text Department between the strong tags.
Department: Department Name

??¦
employee.appendChild(br);
strong = document.


Pages:
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106