21_785970 bindex.qxp 1/20/06 12:28 PM Page 337

Index

>= (greater-than-or-equal-to) operator, • Symbols • function of, 54 + (addition) operator, function of, 52 ++ (increment) operator, function of, 52 += (addition sign, equal sign) operator, += (joining strings) operator, function of, 53 function of, 52 &= (ampersand, equal sign) operator, << (left shift) operator, function of, 53 function of, 53 < (less-than) operator, function of, 54 *= (asterisk, equal sign) operator, <<= (less-than sign, less-than sign, equal function of, 53 sign) operator, function of, 54 */ (asterisk, slash), writing PHP script >? (less-than sign, question mark), comments and, 301 enclosing PHP script in, 298 /= (backslash, equal sign) operator, <= (less-than-or-equal-to) operator, function of, 53 function of, 54 & (bitwise AND) operator, function of, 52 && (logical AND) operator, function ~ (bitwise NOT) operator, function of, 53 of, 52 | (bitwise OR) operator, function of, 52 ! (logical NOT) operator, function of, 52 ^ (bitwise XOR) operator, function of, 52 | | (logical OR) operator, function of, 52 ^= (caret, equal sign) operator, * (multiplication) operator, function function of, 53 of, 52 , (comma) operator, function of, 55 \n (newline character), in PHP , (comma), passing multiple arguments script, 319 to JavaScript functions, 47–48 != (not-equal-to) operator, function of, 54 ?: (conditional) operator, function of, 55 () (parentheses), passing single argu- -- (decrement) operator, function of, 52 ment to JavaScript function and, / (division) operator, function of, 52 44–45 $ (dollar sign), indicating PHP script %= (percent sign, equal sign) operator, variables, 301–302 function of, 53 // (double slash) marker, adding “” (quotation marks) comments to JavaScript with, 28–29 passing JavaScript functions and, 157 = (equal sign) operator, function of, 53 using in JavaScript, 36–37 == (equality) operator, function of, 54 ; (semicolon) > (greater-than) operator,COPYRIGHTED function of, 54 ending MATERIAL JavaScript lines with, 28 >>= (greater-than sign, greater-than sign, ending PHP script lines with, 28 equal sign) operator, function of, 54 # (sharp sign), assigning styles and, 274 >>>= (greater-than sign, greater-than >> (sign-propagating right shift) sign, greater-than sign, equal sign) operator, function of, 53 operator, function of, 54 /* (slash, asterisk), writing PHP script

338 For Dummies

+ (string addition) operator, function Ajax Gold library of, 52 describing getDataReturnText - (subtraction) operator, function of, 52 function, 158–159 -= (subtraction sign, equal sign) describing getDataReturnXml operator, function of, 53 function, 162–163 |= (vertical line, equal sign) operator, describing postDataReturnText function of, 54 function, 166–170 >>> (zero-fill right shift) operator, describing postDataReturnXML function of, 53 function, 170 overview, 157 verifying loading and availability of, • A • 161–162 abort method Ajax Matters Web site, 332–333 and Navigator, 82 Ajax Patterns Web site, 332 , 81 Ajax Tags Library, handling JavaServer , 83 Pages with, 229–231 absolute positioning, of Web page AJAXLib framework, using, 174–176 elements, 292–295 alert box, overview, 69–71 absolute URLs, versus relative, 90–91 ampersand, equal sign (&=) operator, action attribute, setting in PHP function of, 53 script, 310 anonymous functions actions, responding to, 33 creating, 55 Adaptive Path Web site, 331–332 handling asynchronous downloads and, addem function 86, 111 creating JavaScript for use in browsers Apache Tomcat (Java-based server), 225 with Xajax and, 218–220 Apple Safari in Sajax, 215–217 alternate ways of retrieving XMLHttp in Xajax, 218–220 Request object in, 92–93 addition (+) operator, function of, 52 Web sites for XMLHttpRequest addition sign, equal sign (+=) operator, objects references, 333 function of, 53 XMLHttpRequest object methods “Ajax: A New Approach to Web for, 83 Applications” (Garrett), 11, 331–332 XMLHttpRequest object properties Ajax blogs, 333 for, 82–83 Ajax discussion group, 334–335 applications, autocomplete, 13–14 Ajax Gold Framework arguments overview, 157–158 passing multiple to JavaScript function, posting data to and retrieving text from 47–48 server with POST method, 166–170 passing single to JavaScript functions, posting data to and retrieving XML 44–45 from server with POST method, arithmetic operators, functions of, 52 170–173 arrays using GET method to retrieve text, overview, 66–67 158–162 retrieving data from text fields in PHP using GET method to retrieve XML, script and, 311–312 162–165 storing extracted XML data, 103 21_785970 bindex.qxp 1/20/06 12:28 PM Page 339

Index 339

turning text into, 282–283 bitwise AND (&) operator, function of, 52 while loop and, 67–69 bitwise NOT (~) operator, function of, 53 working with multiple XMLHttp bitwise operators, functions of, 52–53 Request objects and, 146–147 bitwise OR (|) operator, function of, 52 ASP.NET, 234 bitwise XOR (^) operator, function of, 52 assignment operators, functions of, block elements, overview, 45 53–54 blogs, Ajax, 333 asterisk, equal sign (*=) operator, bookmarks, Ajax disabling browser, function of, 53 325–326 asterisk, slash (*/), writing PHP script bottom property comments and, 301 absolute positioning function of, 293 asyncFlag parameter, for open relative positioning function of, 295 method, 84 boxes asynchronous downloads, handling, alert, 69–71 85–88 populating list with Direct Web Atlas Client Script Framework, 234 Remoting, 227 attributes property, function of, 244 positioning for, 292 autocomplete using PHP script with check, 312–314 capabilities, 13–14 browser events with JPSpan framework, 224 calling JavaScript functions and, 40–44 with Ruby on Rails framework, 233 common JavaScript in Ajax using Ajax Tags Library, 230 applications, 34 Autocomplete JSP tag, 230 working with, 35–36 browsers. See also specific browsers accessing from JavaScript, 26–27 • B • Ajax disabling back button in, 325–326 back button, Ajax disabling browser, Ajax disabling bookmarks in, 325–326 325–326 avoiding cache in, 329 Backbase framework, 234 avoiding sluggish, 328 background-attachment property, awareness of various, 327 function of, 289 calling different Web domains and, background-color property, 130–131 function of, 289 creating Ajax JavaScript for use in with background-image property, Xajax, 218–220 function of, 289 data validation in, 132 background-position property, determining if code will work with, 79 function of, 289 determining type with conditions, backgrounds, setting with cascading 62–64 style sheets, 289–292 downloading images with Ajax and backslash, equal sign (/=) operator, Dynamic HTML, 154–156 function of, 53 handling drag-and-drop events, 183 backup plans, for working offline, 328 handling mouse events, 185 bgcolor property, setting, 35–36 handling older with HTMLHttpRequest binary data objects, downloading with framework, 199–200 Ajax and Dynamic HTML, 156 identifying JavaScript errors and, 30–32 21_785970 bindex.qxp 1/20/06 12:28 PM Page 340

340 Ajax For Dummies

browsers. See also specific browsers setting colors and backgrounds with, (continued) 289–292 JavaScript working with various, 32–33 styling text with, 287–288 listening for mouse move events, 187 channel property, Firefox and retrieving text with Ajax, 21–22 Navigator, 82 sending text to with PHP script, 299 chatting sending XML to with PHP script, Ajax-based, 14–15 299–300 with Direct Web Remoting, 227 setting up for debugging, 140–142 check boxes, using with PHP script, buttons. See also HTML controls 312–314 displaying messages by clicking, 69–71 checkUsername function, data reading text fields by clicking, 71–72 validation and, 133 retrieving data from server and childNodes property, function of, 244 displaying by clicking, 76–78 clearCache () function, in libXml Request framework library, 177 color property, function of, 289 • C • colors caching browsers understanding, 36 avoiding, 329 setting with cascading style sheets, controlling with libXmlRequest 289–292 framework library, 177 comma (,) operator, function of, 55 Http framework handling, 211–212 comma (,), passing multiple arguments Interactive Framework to JavaScript functions, 47–48 preventing, 198 comments callback functions adding to JavaScript, 28–29 defined, 157 in PHP script, 301 in libXmlRequest framework companion Web site, downloading library, 177 examples from, 22–23 posting data to and retrieving text from comparison operators, functions of, 54 server with, 166–167 conditional (?:) operator, function of, 55 retrieving text from URLs, 162 conditions working with Sajax and, 217 determining browser type in JavaScript Callout JSP tag, 230 with, 62–64 caret, equal sign (^=) operator, testing in JavaScript, 59 function of, 53 using JavaScript if statement and, cascading style sheets (CSS) 59–60 absolute positioning, 292–295 using PHP script else statement and, Ajax programmers’ fondness of, 269 307 coloring shopping cart and items with using PHP script if statement and, styles, 184–185 306–307 making Web page changes stand out, Couvreur, Julien (XMLHttpRequest 285–286 debugger developer), 140 overview, 270–271 CSS (cascading style sheets) relative positioning, 295–296 absolute positioning, 292–295 Ajax programmers’ fondness of, 269 21_785970 bindex.qxp 1/20/06 12:28 PM Page 341

Index 341

coloring shopping cart and items with retrieving from radio buttons with PHP styles, 184–185 script, 314–316 making Web page changes stand out, retrieving from server, 9 285–286 retrieving from server and displaying, overview, 270–271 76–78 relative positioning, 295–296 retrieving from text fields in PHP script, setting colors and backgrounds with, 311–312 289–292 retrieving menu, 278–279 styling text with, 287–288 retrieving with XMLHttpRequest CSS Web Design For Dummies object, 88–90 (Mansfield), 271 showing response from Google search, 125–130 data storage • D • of extracted XML data, 103 data in PHP script variables, 301–304 accessing complete Http header, using JavaScript variables, 48–49 135–136 var statement, 49–50 accessing with HEAD requests, 134–135 data validation, on servers, 131–134 altering variable, 55–56 databases, working with PHP script with, changing without new page fetch, 21–22 320–321 displaying extracted XML in Internet data.txt file Explorer, 249–250 accessing complete, 135–136 displaying in HTML element using Rico accessing last modified date from Http framework, 206–208 headers, 136–138 extracting XML, 102–104 accessing with HEAD requests, 134–135 extracting XML using properties, verifying existence of, 139–140 243–250 date object, sampling of methods handling Google-sent, 121–122 for, 138 handling sensitive, 328 dates, accessing last modified from Http handling with JavaScript objects using headers, 136–138 Rico framework, 208–211 debugging hiding menu, 280–281 with Greasemonkey, 142–143 JavaScript guessing treatment of, 56 overview, 140 listing in drop-down control, 104–106 setting up browsers for, 140–142 passing to server with GET method, decodeXML function, retrieving XML 106–109 and, 178–179 passing to server with POST method, decrement (--) operator, function of, 52 109–112 delete operator, function of, 55 posting to server and retrieving text, developers, Ajax advantages to, 11–12 166–170 DHTML (Dynamic HTML) posting to server and retrieving XML, Ajax programmers’ fondness of, 269 170–173 downloading images with, 154–156 requesting XML in Ajax, 240–242 inserting text with, 47 retrieving from check boxes with PHP usefulness of, 270 script, 312–314 21_785970 bindex.qxp 1/20/06 12:28 PM Page 342

342 Ajax For Dummies

Direct Web Remoting (DWR) framework, handling mouse down events for, accessing Java with, 225–228 187–188 directories, downloading LibAjax handling mouse events for, 185–186 example and, 221 handling mouse up events for, 189 display function, displaying user menu handling mouse-move events for, 189 selection, 284–285 overview, 182–185

element drop-down control displaying text after page has loaded listing data in, 104–106 and, 42–43 storing data in, 103–104 versus element, 45–47 DTD (XML document type definition) division (/) operator, function of, 52 overview, 240 document object, accessing
validating XML documents and, element with, 43 264–267 documentElement property DWR (Direct Web Remoting) framework, function of, 244 accessing Java with, 225–228 handling white space in Mozilla-based Dykes, Lucinda (XML For Dummies, 4th browsers and, 251 Edition), 238 navigating XML documents with in Dynamic HTML (DHTML) Internet Explorer, 245 Ajax programmers’ fondness of, 269 documents, XML downloading images with, 154–156 handling white space in with Mozilla inserting text with, 47 Firefox, 250–253 usefulness of, 270 making valid, 240 navigating with JavaScript properties, 245–249 • E • overview, 99 Echo2 framework, building Web removing white space from in Mozilla- applications with, 228–229 based browsers, 254–258 ECMA (European Computer requesting data from in Ajax, 240–242 Manufacturers Association), validating in Ajax applications, 263–267 standardizing JavaScript, 25 well-formed, 239–240, 263 ECMAScript Components document.write method, passing Specification, 25 arguments to JavaScript functions, ECMAScript, creating, 25 44–45 ECMAScript Language Specification, Dojo framework, 234 3rd Edition, 25 dollar sign ($), indicating PHP script ECMAScript 3rd Edition Compact Profile variables, 301–302 Specification, 25 double slash (//) marker, adding Eich, Brendan (JavaScript creator), 24 comments to JavaScript with, 28–29 elements do...while loop, in PHP script, 309 absolute positioning of Web page, drag-and-drop operations, using Sajax 292–295 for, 218 accessing XML by name, 258–260 drag-and-drop shopping cascading style sheets and, 270–271 capabilities, 15–16 displaying data in HTML using Rico enabling, 9 framework, 206–208 21_785970 bindex.qxp 1/20/06 12:28 PM Page 343

Index 343

relative positioning of Web page, file extensions, storing JavaScript code 295–296 outside Web pages and, 29–30 setting styles for, 272–277 file handle, PHP script XML document, 239–240 reading from Google URL with, 129 else statement reading server files with, 318 determining browser type with files JavaScript, 62–64 reading server with PHP script, 317–319 JavaScript, 59 storing code outside Web pages in, PHP script, 59 29–30 using JavaScript, 61–62 writing to server with PHP script, embedded styles, using, 273 319–320 equal sign (=) operator, function of, 53 Firefox equality (==) operator, function of, 54 advantages of with JavaScript, 32 errors, examining JavaScript, 30–32 alternate ways of retrieving XMLHttp escape function, appending text to URL Request object in, 92–93 and, 107 caching in, 211–212 European Computer Manufacturers debugging JavaScript and, 140 Association (ECMA), standardizing handling mouse events, 185 JavaScript, 25 handling XML document white space eval function in, 250–253 executing Google search response, 125 identifying JavaScript errors in, 30–31 executing server-side JavaScript removing XML document white space and, 116–117 in, 254–258 returning objects from server with, 118 Web sites for XMLHttpRequest events objects references, 333 calling JavaScript functions and XML validation and, 264 browser, 40–44 XMLHttpRequest object methods common JavaScript browser, in Ajax for, 82 applications, 34 XMLHttpRequest object properties handling mouse, 185–186 for, 82 handling mouse down, 187–188 firstChild property handling mouse up, 189–191 function of, 244 handling mouse-move, 189 handling white space in Mozilla-based working with browser, 35–36 browsers and, 251 examples, downloading from companion navigating XML documents with in Web site, 22–23 Internet Explorer, 246, 248 exporting font-family property, function of, 287 PHP functions in LibAjax font-size property, function of, 287 framework, 222 font-style property, function of, 287 PHP functions in Sajax framework, 215 font-weight property, function of, 287 external style sheets, using, 276–277 fopen function, reading files with, 317–319 for loop • F • in JavaScript, 64–66 fclose function, closing files with, 319 in PHP script, 307–308 21_785970 bindex.qxp 1/20/06 12:28 PM Page 344

344 Ajax For Dummies

foreach loop, in PHP script, 309 using AJAXLib, 174–176 frameworks using JPSpan, 224 accessing Java with Direct Web using Ruby on Rails, 233 Remoting, 225–228 XHConn, 194–196 Ajax Gold, 157–158 function operator, function of, 55 availability/usefulness of, 153–154 functions. See also specific functions avoiding caching with, 329 accessing JavaScript with PHP in Backbase, 234 Sajax, 215 building Web applications with Echo2 calling JavaScript, 40–44 framework, 228–229 calling JavaScript in a