Specifi
cally, any problematic fi eld
will have its label class switched
from the default title to error.
Upon a resubmission of the form,
the labels should have their class
values reset so that they can
refl ect the new results.
adding records via Ajax 85
extra bits (cont.)
display the results p. 79
??? The message variable refers to
every XML element with a name
of result (see the code earlier
in the function). Even though
the XML data will only ever have
one such element, an array is
still returned. So the text itself is
accessed via the unwieldy message[
0].firstChild.nodeValue.
??? As with the previous Ajax example,
the innerHTML property is
used to put a message within the
results DIV.
??? To indicate a problem with a
form element, its corresponding
label will have its class
changed from title to error.
Using the Document Object
Model, document.getElement-
ById(temp + ???_label??™) will
refer to the label (where temp
stores the name of the form element).
Then .className lets you
change its class.
handle the XML p. 77
??? The server??™s response is available
in two attributes of the
XMLHttpRequest object.
Pages:
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87