Copyrighted Material
Total Page:16
File Type:pdf, Size:1020Kb
15_043067 bindex.qxd 6/15/06 7:38 PM Page 330 INDEX accessing XML on server, 172–173 A downloading and installing, 170–171, 176 absolute positioning, 288–289 downloading XML data, 174–175 add function, 40–41 stripping out whitespace, 172, 173, 174 addition function for XML data extraction, 82–83 URL encoding, 171 addition operator (+) (JavaScript), 40, 44, 45 alert boxes Ajax (Asynchronous JavaScript + XML). See also Ajax display by JavaScript function, 30–31 XMLHttpRequest frameworks; object displaying, 28–29 advantages, 2, 3, 62 displaying text from text fields, 37 attributes, 29, 262–263 aligning text in CSS, 278–279 downloading JavaScript, 94–95 AND logical operator (JavaScript), 53 event attributes, 29 anonymous JavaScript functions, 68 example of data Submit and fetch, 4–5 Apache Tomcat Java-based server, 231 XMLHttpRequest importance of object, 62 Apple Safari, 63 server-side scripts and PHP used with, 76–77 arguments, passing to functions, 38–39 Ajax frameworks arithmetic operators (JavaScript), 45 ! caution: importance of files and placement, 152 assignment operators (JavaScript), 44, 45 resultXML ! caution: naming global variable “ ”, 171, 175 asynchronous versus synchronous requests, ! caution: on use of global variables, 155, 159 178, 180 advantages, 152–153 attributes (Ajax), 29, 262–263 Ajax tag library, 236–239 autocomplete capability AJAXLib Ajax framework, 170–175 example demonstration site, 8–9 browser-based versus server-side, 152 support for, in Ajax tag library, 236–237 downloadable and free, 182 installing and allowing access, 152–153 IWF (Interactive Website Framework), 200–205 B JavaScript and server-side, 11, 152 background color setting in CSS, 284–285 LibAjax server-side Ajax framework, 224–229 background image setting in CSS, 286–287 libXmlRequest Ajax framework, 176–181 binary objects, 23, 140 reading text with GET method, 154–157 block elements in HTML, 278 reading text with POST method, 162–163, 164–165 boldface, 24, 276–277 reading XML from server, 158–159, 160–161, 166–167, broadcasts with instant messaging, 21 168–169 browser events, 28–29, 34–35 SACK Ajax framework, 188–193 browsers SAJAX server-side Ajax framework, 212–217 ! caution: ignoring visibility style property, 292 Sarissa Ajax framework, 194–197 ! caution: on avoiding caching at URL, 177, 200 sending to server with URL encoding, 155, 157, 159, 161 ! caution: on passing JavaScript to, 95 Xajax server-side Ajax framework,COPYRIGHTED 218–223 accessing MATERIAL different domains, 118–119 XHConn Ajax framework, 182–187 checking before creating XMLHttpRequest object, Ajax tag library 64–65 returning data from server, 239 determining type and version, 54–55, 259 support for autocomplete, 236–237 downloading images, text, or XML, 22–23 support for callouts, pop-ups, 237 instant messaging with, 21 updating HTML controls, 238–239 problems of display refresh, 2, 4, 10, 18 updating one field from results of another, 237 viewing JavaScript errors, 26–27 AJAXLib Ajax framework ! caution: on lack of built-in error handling, 175 ! caution: on use of global variable resultXML, 171, 175 330 15_043067 bindex.qxd 6/15/06 7:38 PM Page 331 dialog boxes as alert boxes, 28–29 C Direct Web Remoting (DWR). See DWR (Direct Web calculator example (JavaScript operators), 45–47 Remoting) callback functions, 154 directories calling JavaScript functions, 30–31 for data for server-side scripts, 76, 77 callouts and pop-ups, Ajax tag library, 237 importance of Ajax framework file placement, 152, 153 capitalization of JavaScript variables, 43 indicating parent, 73 centering text in CSS, 278–279 displayText() function, 36–37, 38–39 centimeters as units of measurement, 289 do while loops (JavaScript), 61 check box creation and reading, 316–317 document objects (JavaScript), 24 childNodes and siblingNodes properties (JavaScript), document.getElementById(‘targetDiv’).inner 245, 248–251 HTML expression, 33, 42 clicks. See also mouse events document.getElementById(‘text1’) expression, browser events, 28–29, 34–35 36, 37 colors documents background, setting in CSS, 284–285 analyzing and extracting header information, 108–109 foreground, setting in CSS, 280–281 checking existence and accessibility, 110–111 commas (,) separating arguments, 39 document.write method, 24, 32 commenting domains, accessing, 118–119 HTML, 25 download time penalty, 2 JavaScript, 25 downloadable code for this book comparison operators (JavaScript), 45, 52–53, 137 ajaxframework.js sample Ajax framework, 160, 164 CSS (Cascading Style Sheets) movie.jpg, 92 ! caution: use absolute positioning, 147 drag and drop advantages, 10, 270 avoiding multiple-page shopping, 12–13 aligning text, 278–279 handling mouse down and up events, 124–125 background color settings, 284–285 with RICO JavaScript framework, 206–207 boldfacing text, 276–277 support by IWF (Interactive Website Framework), 201 creating pop-ups, 294–295 driving directions from Google Maps, 17 creating style rules, 270–271 drop-down menus. See menu systems displaying menu systems, 144, 146–147 DWR (Direct Web Remoting) foreground color settings, 280–281 downloading and installing, 230 hiding menu systems, 148–149 editing interactive HTML table, 232–233 moving HTML elements, 296–297 requiring Java-enabled Web server, 230 overlapping HTML elements, 298–299 dynamic HTML. See also HTML positioning elements using absolute positioning, 288–289 display of updated elements, 10 positioning elements using relative positioning, 290–291 downloading images and other binary objects, 22–23, setting font family and size, 272–273 140–141 setting HTML element visibility, 292–293 positioning text and images, 32–33 specifying styles for HTML elements, 271 underlining or italicizing text, 274–275 E curly braces ({}) e-mail handling with Echo2, 234–235 for code handling downloaded data, 68 Echo2 Java framework, 234–235, 235 enclosing JavaScript functions, 30 else clause of if statements (JavaScript), 51 encodeURI function (JavaScript), 89, 99 D error handling. See also security considerations debugging. See error handling ! caution: on absence from AJAXLib, 175 decrement operators (JavaScript), 44, 45 ! caution: on absence from XHConn, 187 331 15_043067 bindex.qxd 6/15/06 7:38 PM Page 332 INDEX accessing different domains, 118–119 forward slashes (//) advantages of small JavaScript files, 27 for commenting JavaScript, 25 Ajax using Firefox browser, 120–121 functions avoiding server-side accesses, 105 callback, 154 in case of missing document or PHP script, 111 creating JavaScript, 30–31 in cases of multiple responses to XMLHttpRequest definition, 24, 30 object, 113 inner, 116 common HTTP errors, 69 passing arguments to, 38–39 displaying customized error messages, 269 returning data from, 40–41 exception objects (JavaScript), 75 unlimited lines of code, 31 importance of download status and error checking, 83, 84 JavaScript using browser, 26–27 G reading input and validating via server, 102–105 games online, 18–19, 131 XML documents with Internet Explorer, 241, 242–243, GET method 268–269 compared to POST method, 162, 163, 166, 167 XMLHttpRequest objects with script, 120 passing data to server-side scripts, 88–89 eval function (JavaScript), 94 reading or passing type parameter, 86–87 events. See also mouse events URL-encoding of data, 67 browser, 28 getAllResponseHeaders method, 106, 107 button clicks for execution of JavaScript code, 34 getData function, 66, 67, 70, 72 common attributes in Ajax applications, 29 getElementByI method, 33, 36 exception objects (JavaScript), 75 getElementsByTagName method (JavaScript), 82, 247, Extensible Hypertext Markup Language (XHTML). See 260–261 XML getResponseHeader method, 108–109 global JavaScript variables, 48–49 F ! caution: on use of, 155, 159 Google as Ajax-enabled site, 7 file handles, 328 Google Maps, 16–17 Firefox Google Search debugging capability, 26, 27, 120–121 example of live search, 6–7 determining presence and version, 54–55 Google Suggest, 6, 7 disconnecting mouse events from JavaScript, 136 connecting to, 98–99 Greasemonkey, 120, 121 creating JavaScript, 100 methods and properties for XMLHttpRequest object, 63 displaying search results, 100–101 mouse event handling, 122, 124, 126, 128, 130 Greasemonkey (Firefox), 120, 121 mouse listener functions, 134 greater than/less than operators (> <) (JavaScript), 52 predefined colors for text, 280 selecting Google as home page, 7 H specifying italics, 274 HEAD request, 106–107, 110 font header information font-weight property in CSS, 276 analysis and extraction of specifics, 108–109 formatting size or bold, 24 retrieval, 106–107 formatting with CSS style rules, 270–283 HTML. See also dynamic HTML Fonz and Ajax, 19 adding + and - buttons for calculator, 47 for loops, 56–57, 58 block elements, 278 foreground colors, setting in CSS, 280–281 coding JavaScript in script element, 24–25 <form> elements, 34–35 332 15_043067 bindex.qxd 6/15/06 7:38 PM Page 333 commenting, 25 predefined colors for text, 280 controls updates with Ajax tag library, 238–239 selecting Google as home page, 7 event attributes, 28 specifying italics, 274 in PHP scripts, 77 support of marquee element, 54 reading controls data, 87 tests for XML documents, 242–243 HTML elements. See also SACK Ajax framework; shopping italics for text cart application specifying in CSS, 274–275 form for enclosure of controls, 34–35 IWF (Interactive Website Framework) absolute positioning, 288–289 avoiding return of cached data, 200 hiding, 293 connecting to server, 202–203 as JavaScript objects, 33 downloading and installing,