Prev | Current Page 96 | Next

Larry Ullman

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

com???>address@example.
com
??¦
employee.appendChild(br);
a = document.createElement(???a??™);
a.setAttribute(???href??™, ???mailto:??™ + emails[i].
firstChild.nodeValue);
enabling an Ajax search 119
3 A text node is created with a value of the
employee??™s email address from the XML data.
4 The text node is made a child of the a node.
Therefore, the text node (which is the employee??™s
email address) is within the a.
5 The a element is attached to the paragraph.
6 The entire paragraph, which represents all of
the employee??™s data, is made a child of the results
DIV. (See extra bits on page 128.)
email = document.
createTextNode(emails[i].firstChild.nodeValue);
a.appendChild(email);
employee.appendChild(a);
results.appendChild(employee);
} // End of FOR loop.
handle the email (cont.)
120 enabling an Ajax search
display no results
If the PHP page returned no results, a message should be displayed
saying as much.
1 A new element of type p is created.
2 The class attribute of the paragraph is given a value of error.
3 A text node is created with a value of
No employees were a match.


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