Javascript & DHTML Cookbook

Total Page:16

File Type:pdf, Size:1020Kb

Javascript & DHTML Cookbook SECOND EDITION JavaScript & DHTML Cookbook Danny Goodman O'REILLY8 Beijing • Cambridge • Farnham • Koln • Paris • Sebastopol • Taipei • Tokyo Table of Contents Preface xiii 1. Strings 1 1.1 Concatenating (Joining) Strings 4 1.2 Improving String Handling Performance 6 1.3 Accessing Substrings 7 1.4 Changing String Case 8 1.5 Testing Equality of Two Strings 9 1.6 Testing String Containment Without Regular Expressions 11 1.7 Testing String Containment with Regular Expressions 13 1.8 Searching and Replacing Substrings 14 1.9 Using Special and Escaped Characters 15 1.10 Reading and Writing Strings for Cookies 17 1.11, Converting Between Unicode Values and String Characters 20 1.12 Encoding and Decoding URL Strings 21 1.13 Encoding and Decoding Base64 Strings 23 2. Numbers and Dates 27 2.1 Converting Between Numbers and Strings 31 2.2 Testing a Number's Validity 33 2.3 Testing Numeric Ecjuality 34 2.4 Rounding Floating-Point Numbers 35 2.5 Formatting Numbers for Text Display 36 2.6 Converting Between Decimal and Hexadecimal Numbers 39 2.7 Generating Pseudorandom Numbers 41 2.8 Calculating Trigonometric Functions 41 2.9 Creating a Date Object 42 2.10 Calculating a Previous or Future Date 43 2.11 Calculating the Number of Days Between Two Dates 45 2.12 Validating a Date 47 3. Arrays and Objects 51 3.1 Creating a Simple Array 54 3.2 Creating a Multidimensional Array 56 3.3 Converting Between Arrays and Strings 57 3.4 Doing Something with the Items in an Array 59 3.5 Sorting a Simple Array 61 3.6 Combining Arrays 63 3.7 Dividing Arrays 64 3.8 Creating a Custom Object 65 3.9 Simulating a Hash Table for Fast Array Lookup 69 3.10 Doing Something with a Property of an Object 71 3.11 Sorting an Array of Objects 72 3.12 Customizing an Object's Prototype 74 3.13 Converting Arrays and Custom Objects to Strings 79 3.14 Using Objects to Reduce Naming Conflicts 82 4. Variables, Functions, and Flow Control 85 4.1 Creating a JavaScript Variable 85 4.2 Creating a Named Function 89 4.3 Nesting Named Functions 92 4.4 Creating an Anonymous Function 93 4.5 Delaying a Function Call -_-, 94 4.6 Branching Execution Based on Conditions 97 4.7 Handling Script Errors Gracefully 101 4.8 Improving Script Performance 103 5. Browser Feature Detection 107 5.1 Detecting the Browser Brand ' 113 5.2 Detecting an Early Browser Version & 113 5.3 Detecting the Internet Explorer Version 115 5.4 Detecting the Mozilla Version 116 5.5 Detecting the Safari Version 118 5.6 Detecting the Opera Version 119 5.7 Detecting the Client Operating System 120 5.8 Detecting Object Support 121 Table of Contents 5.9 Detecting Object Property and Method Support 124 5.10 Detecting W3C DOM Standard Support 126 5.11 Detecting the Browser Written Language 127 5.12 Detecting Cookie Availability 128 5.13 Defining Browser-or Feature-Specific Links 129 5.14 Testing on Multiple Browser Versions 130 6. Managing Browser Windows 132 6.1 Living with Browser Window Control Limitations 135 6.2 Setting the Main Window's Size 136 6.3 Positioning the Main Window . 137 6.4 Maximizing the Main Window 138 6.5 Creating a New Window 139 6.6 Bringing a Window to the Front 143 6.7 Communicating with a New Window 144 6.8 Communicating Back to the Main Window 147 6.9 Using Internet Explorer Modal/Modeless Windows 148 6.10 Simulating a Cross-Browser Modal Dialog Window 151 6.11 Simulating a Window with Layers 158 7. Managing Multiple Frames 173 7.1 Creating a Blank Frame in a New Frameset 178 li 1.1 Changing the Content of One Frame from Another 179 7.3 Changing the Content of Multiple Frames at Once 181 7.4 Replacing a Frameset with a Single Page 182 7.5' Avoiding Being "Framed" by Another Site . 183 7.6 Ensuring a Page Loads in Its Frameset 184 7.7 Reading a Frame's Dimensions 187 7.8 Resizing Frames 188 7.9 Setting Frameset Specifications Dynamically 192 8. Dynamic Forms 194 8.1 Auto-Focusing theFirst Text Field 197 8.2 Performing Common Text Field Validations 198 8.3 Preventing Form Submission upon Validation Failure 204 8.4 Auto-Focusing an Invalid Text Field Entry 207 8.5 Using a Custom Validation Object 208 8.6 Changing a Form's Action 213 8.7 Blocking Submissions from the Enter Key 214 Table of Contents I vii 8.8 Advancing Text Field Focus with the Enter Key 215 8.9 Submitting a Form by an Enter Key Press in Any Text Box 216 8.10 Disabling Form Controls 217 8.11 Hiding and Showing Form Controls 219 8.12 Allowing Only Numbers (or Letters) in a Text Box 221 8.13 Auto-Tabbing for Fixed-Length Text Boxes 223 8.14 Changing select Element Content 224 8.15 Copying Form Data Between Pages 227 9. Managing Events 231 9.1 Equalizing the IE and W3C Event Models 236 9.2 Initiating a Process After the Page Loads 240 9.3 Appending Multiple Load Event Handlers 242 9.4 Determining the Coordinates of a Click Event 244 9.5 Preventing an Event from Performing Its Default Behavior 248 9.6 Blocking Duplicate Clicks 251 9.7 Determining Which Element Received an Event 252 9.8 Determining Which Mouse Button Was Pressed 254 9.9 Reading Which Character Key Was Typed 256 9.10 Reading Which Noncharacter Key Was Pressed 257 9.11 Determining Which Modifier Keys Were Pressed During an Event 260 9.12 Determining the Element the Cursor Rolled From/To 262 9.13 Synchronizing Sounds to Events 266 10. Page Navigation Techniques 268 10.1 Loading a New Page or'Anchor- 271 10.2 Keeping a Page Out of the Browser History 273 10.3 Using a select Element for Navigation 274 10.4 Passing Data Between Pages via Cookies 276 10.5 Passing Data Between Pages via Frames 278 10.6 Passing Data Between Pages via URLs 280 10.7 Creating a Contextual (Right-Click) Menu 283 10.8 Creating Drop-Down Navigation Menus " 291 10.9 Providing Navigation Trail Menus 305 10.10 Creating Expandable Menus 308 10.11 Creating Collapsible XML Menus 320 viii I Table of Contents 11. Managing Style Sheets 331 11.1 Assigning Style Sheet Rules to an Element Globally 333 11.2 Assigning Style Sheet Rules to a Subgroup of Elements 334 , 11.3 Assigning Style Sheet Rules to an Individual Element 336 11.4 Importing External Style Sheets 337 11.5 Importing Browser-or Operating System-Specific Style Sheets 338 11.6 Changing Imported Style Sheets After Loading 340 11.7 Enabling/Disabling Style Sheets 341 11.8 Toggling Between Style Sheets for an Element 342 11.9 Overriding a Style Sheet Rule 343 11.10 Turning Arbitrary Content into a Styled Element 344 11.11 Creating Center-Aligned Body Elements 345 11.12 Reading Effective Style Sheet Property Values 346 11.13 Forcing Recent Browsers into Standards-Compatibility Mode 348 12. Visual Effects for Stationary Content .. 351 12.1 Precaching Images 354 12.2 Swapping Images (Rollovers) 356 12.3 Reducing Rollover Image Downloads with JavaScript 358 12.4 Reducing Rollover Image Downloads with CSS 362 12.5 Dynamically Changing Image Sizes 366 12.6 Changing Text Style Properties 367 i 12.7 Offering Body Text Size Choices to Users 370 12.8 Creating Custom Link Styles 374 12.9 Changing Page Background Colors and Images 375 12.10 Hiding and Showing Elements 378 12.11 Adjusting Element Transparency 379 12.12 Creating Transition Visual Effects 381 12.13 Drawing Charts in the Canvas Element 385 13. Positioning HTML Elements 392 13.1 Making an Element Positionable in the Document Space 397 13.2 Connecting a Positioned Element to a Body Element 398 13.3 Controlling Positioning via a DHTML JavaScript Library 400 13.4 Deciding Between div and span Containers 407 13.5 Adjusting Positioned Element Stacking Order (Z-order) 409 13.6 Centering an Element on Top of Another Element 410 13.7 Centering an Element in a Window or Frame •• 412 Table of Contents 13.8 Determining the Location of a Nonpositioned Element 414 13.9 Animating Straight-Line Element Paths 415 13.10 Animating Circular Element Paths 419 13.11 Creating a Draggable Element 421 13.12 Scrolling div Content 426 13.13 Creating a Custom Scrollbar 432 13.14 Creating a Slider Control 445 14. Creating Dynamic Content 452 14.1 Writing Dynamic Content During Page Loading 453 14.2 Creating New Page Content Dynamically 454 14.3 Including External HTML Content 456 14.4 Embedding XML Data 458 14.5 Embedding Data As JavaScript Objects 460 14.6 Transforming XML Data into HTML Tables 463 14.7 Transforming JavaScript Objects into HTML Tables 466 14.8 Converting an XML Node Tree to JavaScript Objects 469 14.9 Creating a New HTML Element 470 14.10 Creating Text Content for a New Element 473 14.11 Creating Mixed Element and Text Nodes 474 14.12 Inserting and Populating an iframe Element 476 14.13 Getting a Reference to an HTML Element Object 478 14.14 Referencing All Elements of the Same Class 480 14.15 Replacing Portions of Body Content 482 14.16 Removing Body Content 483 14.17 Using XMLHttpRequest for a REST Request 485 14.18 Using XMLHttpRequest for a SOAP Call 488 14.19 Sorting Dynamic Tables 491 14.20 Walking the Document Node Tree 494 14.21 Capturing Document Content 498 15.
Recommended publications
  • Netscape Navigator 4 Object Road Map "Web Pages That Think"™
    Learn how to create Netscape Navigator 4 Object Road Map "Web Pages That Think"™ window window frame self top parent closedN3,M4 alert("msg") onBlur=N3,M4 defaultStatus back()N4 onDragDrop=N4,(S) document blur()N3,M4 onFocus=N3,M4 history document location toolbar, etc. frames[i] captureEvents(type)N4 onLoad= N4,M4 N4 history clearInterval(ID) onMove= link anchor layer form applet image area innerHeightN4,(S) clearTimeout(ID) onResize=N4,M4 innerWidthN4,(S) close() onUnload= location confirm("msg") text radio button fileUpload select locationbarN4,(S) disableExternalCapture()N4,(S) menubarN4,(S) enableExternalCapture()N4,(S) textarea checkbox reset option name find(["str"][,case, bkwd])N4 password submit onerrorN3,M4 focus()N3,M4 openerN3,M3 forward()N4 outerHeightN4,(S) handleEvent(event)N4 outerWidthN4,(S) home()N4 pageXOffsetN4 moveBy(Dx,Dy)N4,(S) Netscape Navigator 4 Document Object Model Containment Hierarchy pageYOffsetN4 moveTo(x,y)N4,(S) parent open(URL,"name","specs")(1),(S) N4 personalbarN4,(S) print()N4 document layer scrollbarsN4,(S) prompt("msg","reply") alinkColor captureEvents(type)N4 (None) above load("filename",y) onBlur= self releaseEvents(type)N4 anchors[i] clear() background moveAbove(layerObj) onFocus= status resizeBy(Dx,Dy)N4,(S) applets[i]N3,M4 close() below moveBelow(layerObj) onLoad= statusbarN4,(S) resizeTo(width,height)N4,(S) bgColor getSelection()N4,(2) bgColor moveBy(Dx, Dy) onMouseOut= toolbarN4,(S) routeEvent(event)N4 cookie handleEvent(event)N4 clip.top moveTo(x, y) onMouseOver= top scroll(x,y)N3,M4 domainN3,M4
    [Show full text]
  • Javascript Bible 4Th Edition Danny Goodman Javascript and Browser
    JavaScript Bible 4th Edition ISBN 0-7645-3342-8 Danny Goodman Appendix A JavaScript and Browser Objects Quick Reference ©2001 Danny Goodman (www.dannyg.com). All Rights Reserved. 3 © 2001 Danny Goodman (www.dannyg.com). All Rights Reserved. IE4+, NN6+ style Object Properties JSB4 IE4,N6 Operators 40 style 30 Comparison Text & Fonts Borders & Edges Inline Display & Layout == Equals color IE4, N6 borderIE4, N6 clear IE4, N6 N4, IE4 === Strictly equals fontIE4, N6 borderBottomIE4, N6 clip IE4, N6 != Does not equal fontFamily IE4, N6 borderLeftIE4, N6 clipBottom W5 N4, IE4 !== Strictly does not equal JavaScript and fontSize IE4, N6 borderRightIE4, N6 clipLeft W5 > Is greater than fontSizeAdjust M5, N6 borderTopIE4, N6 clipRight W5 >= Is greater than or equal to fontStretch M5, N6 borderBottomColor IE4, N6 clipTop W5 < Is less than Browser Objects fontStyle IE4, N6 borderLeftColorIE4, N6 content M5, N6 <= Is less than or equal to fontVariant IE4, N6 borderRightColorIE4, N6 counterIncrement M5, N6 fontWeight IE4, N6 borderTopColorIE4, N6 counterReset M5, N6 Arithmetic letterSpacing IE4, N6 borderBottomStyle IE4, N6 cssFloat M5, N6 + Plus (and string concat.) Quick Reference lineBreak IE5 borderLeftStyle IE4, N6 cursorIE4, N6 - Minus lineHeight IE4, N6 borderRightStyle IE4, N6 direction IE5, N6 * Multiply quotes M5, N6 borderTopStyle IE4, N6 display IE4, N6 / Divide rubyAlign IE5 borderBottomWidth IE4, N6 filterW4 % Modulo rubyOverhangIE5 borderLeftWidth IE4, N6 floatStyle M4 ++ Increment rubyPosition IE5 borderRightWidth IE4, N6 layoutGrid
    [Show full text]
  • Danny Goodman's Javascript Handbook Object Road Map (Navigator 3.0 Edition) HTML-Generated Javascript Objects
    Danny Goodman's JavaScript Handbook Object Road Map (Navigator 3.0 Edition) HTML-Generated JavaScript Objects window document form frames[i] blur()* onLoad= alinkColor clear() (None) action reset()* onReset=* parent focus()* onUnload= anchors[i] close() elements[i] submit() onSubmit= self scroll(x,y)* onBlur=* applets[i]* open("mimetype") encoding top alert("msg") onFocus=* bgColor write("string") method status confirm("msg") cookie writeln("string") name defaultStatus prompt("msg","reply") domain* target name open(URL,"name","specs") embeds[i]* window close() fgColor opener* setTimeOut("exp",ms) forms[i] onerror* clearTimeOut(ID) images[i]* text, textarea, password lastModified defaultValue focus() onBlur= linkColor name blur() onChange= links[i] type* select() onFocus= history location** value onSelect= referrer length back() (None) title current*** forward() URL* radio next*** go(int | "URL") vlinkColor checked click() onClick= previous*** defaultChecked link length location name target (None) onClick= type* hash reload()* (None) onMouseOut=* value host replace(URL)* onMouseOver= hostname href anchor button, reset, submit pathname name click() onClick= port (None) (None) (None) type* protocol value search applet* (Java vars) (Java methods) (None) checkbox checked click() onClick= area* image* defaultChecked hash (None) onMouseOut= border (None) onAbort= name host onMouseOver= complete onError= type* hostname height onLoad= value href hspace pathname lowsrc port name select protocol src length blur()* onBlur= search vspace name focus()* onChange= target width options[i] onFocus= selectedIndex options[i].defaultSelected fileUpload* options[i].index options[i].selected name blur() onBlur= options[i].text *New in Navigator 3.0 value focus() onFocus= options[i].value **Do not use. To be deleted in a future release select() onSelect= type* ***Only with data tainting enabled ©1996 Danny Goodman.
    [Show full text]
  • Tclosascript - Exec for Mactcl
    The following paper was originally published in the Proceedings of the Fifth Annual Tcl/Tk Workshop Boston, Massachusetts, July 1997 TclOSAScript - Exec for MacTcl Jim Ingham Lucent Technologies (now at Sun Microsystems) Raymond Johnson Sun Microsystems For more information about USENIX Association contact: 1. Phone: 510 528-8649 2. FAX: 510 548-5738 3. Email: [email protected] 4. WWW URL: http://www.usenix.org TclOSAScript-ExecforMacTcl JimIngham LucentTechnologies (nowatSunMicrosystems) [email protected] RaymondJohnson SunMicrosystems [email protected] Abstract: WedescribetheTclOSAScriptextensiontoMacTcl.TclOSAScriptprovides theabilityforMacTclscriptstorunscriptsinanyotherOSAcompatible languageontheMacintosh.SincetheOSAisthestandardmechanismfor interapplicationcommunicationontheMac,thisallowsMacTcltorunother applications,andprovidesanexeclikefacility(thougharguablyusingamuch richercommunicationmodel.) I) AnIntroductiontotheOpen Tk95and96conferences[3,4].Therearetwo ScriptingArchitecture implementationsofthissolutionthathavebeen presented.TedBeldungwroteaextensioncalled Theusualinterapplicationcommunicationmecha- ASTcl[5]whichonlyworkedwithAppleScript,and nismforUnixbasedtoolsreliesonthesimpleex- didnotusemanyoftheadvancedfeaturestheOSA pedientofconnectingthestandardinandstan- offers.TclOSAScript,whichwasdevelopedcon- dardoutchannelsofthespawnedprocesstochan- currently,isamorecompleteimplementation.This nelsoftheparentprocess.Thecommunication istheonewewilldetailinthispaper. betweentheparentandchildprocessesthenmim- ThereisarealproblemthattheOSAaimstosolve
    [Show full text]
  • Javascript Bible 5Th Edition Quick Reference
    JavaScript Bible 5th Edition Danny Goodman Appendix A JavaScript and Browser Objects Quick Reference 18 February 2004 ©2004 Danny Goodman (www.dannyg.com). All Rights Reserved. 3 © 2004 Danny Goodman (www.dannyg.com). All Rights Reserved. IE4+, NN6+ style Object Properties JSB5 IE4,N6 Operators 32 style 26 Comparison Text & Fonts Borders & Edges Inline Display & Layout == Equals color IE4, N6 borderIE4, N6 clear IE4, N6 N4, IE4 === Strictly equals fontIE4, N6 borderBottomIE4, N6 clip IE4, N6 != Does not equal fontFamily IE4, N6 borderLeftIE4, N6 clipBottom W5 N4, IE4 !== Strictly does not equal JavaScript and fontSize IE4, N6 borderRightIE4, N6 clipLeft W5 > Is greater than fontSizeAdjust M5, N6 borderTopIE4, N6 clipRight W5 >= Is greater than or equal to fontStretch M5, N6 borderBottomColor IE4, N6 clipTop W5 < Is less than Browser Objects fontStyle IE4, N6 borderLeftColorIE4, N6 content M5, N6 <= Is less than or equal to fontVariant IE4, N6 borderRightColorIE4, N6 counterIncrement M5, N6 fontWeight IE4, N6 borderTopColorIE4, N6 counterReset M5, N6 Arithmetic letterSpacing IE4, N6 borderBottomStyle IE4, N6 cssFloat M5, N6 Quick Reference IE5 IE4, N6 IE4, N6 + Plus (and string concat.) lineBreak borderLeftStyle cursor - Minus lineHeight IE4, N6 borderRightStyle IE4, N6 direction IE5, N6 * Multiply quotes M5, N6 borderTopStyle IE4, N6 display IE4, N6 / Divide rubyAlign IE5 borderBottomWidth IE4, N6 filterW4 % Modulo rubyOverhangIE5 borderLeftWidth IE4, N6 layoutGrid W5 ++ Increment rubyPosition IE5 borderRightWidth IE4, N6 layoutGridChar
    [Show full text]
  • Fun with Grid Engine XML Hello!
    Fun with Grid Engine XML Hello! I’m Chris ‘[email protected]’ (public) ‘[email protected]’ (corporate) I work for the BioTeam http://bioteam.net Independent consultant shop Scientists self-taught at IT Bridging the science-HPC gap Long OSS involvement http://bioperl.org http://gridengine.info http://xml-qstat.org 2008 OSGC - “Fun with XML” - Chris Dagdigian <[email protected]> Bias Disclosure I’m the industry jerk Cynical Tight focus on practical, deployable solutions In my world … We are not funded by sovereign nations We do not have petabyte- scale filesystems & multi-gig optical WAN links Don’t have 7 figure IT budgets 2008 OSGC - “Fun with XML” - Chris Dagdigian <[email protected]> Background This is a light talk Rehash of 2007 SGE Workshop Talk Basic intro to “doing stuff with XML” Talking about work published here: http://xml-qstat.org Simple web based SGE status dashboard Not rocket science: Transforms SGE qstat XML into useful XHTML 2008 OSGC - “Fun with XML” - Chris Dagdigian <[email protected]> Smarter people than me … Petr Jung (Sun Microsystems) Wrote code that allows … Native SGE queries from Apache Cocoon: java/org/xmlqstat/generator/CommandGenerator Mark “Mr. FLEXlm” Olesen I stole sge-xml-cacher.pl code from his qlicserver Mark Is integrating qlicserver with xmlqstat Resulting in: Much cleaner code for xml-qstat Lots of new functionality (qhost data, resource data, etc.) 2008 OSGC - “Fun with XML” - Chris Dagdigian <[email protected]> Basic need: Web based SGE status monitoring 2008 OSGC - “Fun with XML” - Chris Dagdigian <[email protected]> Basic need: Web based SGE status monitoring The old way (pre SGE 6.0) 1.
    [Show full text]
  • Designing Universally Accessible Web Based Resources
    Instructor Contact Information Great Lakes ADA and On-Line Course Accessible Information Designing Universally Jon Gunderson, Ph.D., APT Technology Center Accessible Web Div. of Rehab. – Education Services Resources College of Applied Life Studies The Great Lakes Center was founded University of Illinois at in 1991 and is one of 10 national February 18th to April 24st Urbana/Champaign centers established by the US 2003 Department of Education, National Voice: (217) 244-5870 Institute on Disability Rehabilitation TTY: (217) 333-4604 and Research (NIDRR) to provide E-mail: [email protected] technical assistance regarding the ADA. The Great Lakes Center serves http://cita.rehab.uiuc.edu/courses the States of Illinois, Indiana, Michigan, Minnesota, Ohio and Wisconsin. Services include operation Course Meeting Times and of an 800 number for technical assistance and dissemination of Dates (Tenative) Instructor information regarding the ADA through training and direct mail. In addition, Dates: February 18th to April 24st Jon Gunderson, Ph.D., ATP the Center has expanded its mission to include issues related to the use Sponsored by Day: Tuesday and Thursday and acquisition of accessible Division of Rehabilitation – Education Services College of Applied Life Studies information technology and it’s impact Time: 4:00 - 5:00 pm CST University of Illinois at Urbana/Champaign on individuals within a variety of And (Chicago, IL local time) settings, including education, business Great Lakes ADA and Accessible IT Center Department of Disability and Human and government. The Center Development consistently ranks the highest for University of Illinois at Chicago Course Technology volume of calls and number of www.adagreatlakes.org And individuals trained among the 10 Illinois Board of Higher Education Slides and Text Chat: HTML Web centers nationally.
    [Show full text]
  • Javascript Bible, 6Th Edition Danny Goodman Javascript and Browser Objects Quick Reference
    JavaScript and Browser Objects Quick Reference JavaScript Bible, 6th Edition Danny Goodman Appendix A ©2007 Danny Goodman (dannyg.com). All Rights Reserved. 2 JavaScript Bible, 6th Edition. ©2007 Danny Goodman (dannyg.com). All Rights Reserved. JavaScript and Browser Objects Quick Reference String 28 Date 30 Control Statements 32 constructor anchor("anchorName") constructor getFullYear() if (condition) { length big() prototype getYear() statementsIfTrue prototype blink() getMonth() } bold() getDate() charAt(index) getDay() if (condition) { charCodeAt([i]) getHours() statementsIfTrue concat(string2) getMinutes() } else { fixed() getSeconds() statementsIfFalse fontcolor(#rrggbb) getTime() } fontsize(1to7) getMilliseconds() fromCharCode(n1...)* getUTCFullYear() result = condition ? expr1 : expr2 indexOf("str" [,i]) getUTCMonth() italics() getUTCDate() for ([init expr]; [condition]; [update expr]) { lastIndexOf("str" [,i]) getUTCDay() statements link(url) getUTCHours() } localeCompare() getUTCMinutes() match(regexp) getUTCSeconds() for (var in object) { replace(regexp,str) getUTCMilliseconds() statements search(regexp) parse("dateString")* } slice(i,j) setYear(val) small() setFullYear(val) for each ([var] varName in objectRef) { split(char) setMonth(val) statements strike() setDate(val) }M1.8.1 sub() setDay(val) substr(start,length) setHours(val) with (objRef) { substring(intA, intB) setMinutes(val) statements sup() setSeconds(val) } toLocaleLowerCase() setMilliseconds(val) toLocaleUpperCase() setTime(val) do { toLowerCase() setUTCFullYear(val)
    [Show full text]
  • Netscape Navigator 4 Object Road Map "Web Pages That Think"™
    Learn how to create Netscape Navigator 4 Object Road Map "Web Pages That Think"™ window window frame self top parent closedN3,M4 alert("msg") onBlur=N3,M4 defaultStatus back()N4 onDragDrop=N4,(S) document blur()N3,M4 onFocus=N3,M4 history document location toolbar, etc. frames[i] captureEvents(type)N4 onLoad= N4,M4 N4 history clearInterval(ID) onMove= link anchor layer form applet image area innerHeightN4,(S) clearTimeout(ID) onResize=N4,M4 innerWidthN4,(S) close() onUnload= location confirm("msg") text radio button fileUpload select locationbarN4,(S) disableExternalCapture()N4,(S) menubarN4,(S) enableExternalCapture()N4,(S) textarea checkbox reset option name find(["str"][,case, bkwd])N4 password submit onerrorN3,M4 focus()N3,M4 openerN3,M3 forward()N4 outerHeightN4,(S) handleEvent(event)N4 outerWidthN4,(S) home()N4 pageXOffsetN4 moveBy( x, y)N4,(S) Netscape Navigator 4 Document Object Model Containment Hierarchy pageYOffsetN4 moveTo(x,y)N4,(S) parent open(URL,"name","specs")(1),(S) N4 personalbarN4,(S) print()N4,M4 document layer scrollbarsN4,(S) prompt("msg","reply") alinkColor captureEvents(type)N4 (None) above load("filename",y) onBlur= self releaseEvents(type)N4 anchors[i] clear() background moveAbove(layerObj) onFocus= status resizeBy( x, y)N4,(S) applets[i]N3,M4 close() below moveBelow(layerObj) onLoad= statusbarN4,(S) resizeTo(width,height)N4,(S) bgColor getSelection()N4,(2) bgColor moveBy( x, y) onMouseOut= toolbarN4,(S) routeEvent(event)N4 cookie handleEvent(event)N4 clip.top moveTo(x, y) onMouseOver= top scroll(x,y)N3,M4 domainN3,M4
    [Show full text]
  • Javascript & DHTML Cookbool(
    SECOND EDITION JavaScript DHTML Cookbool( Danny Goodman OREILLY® Beijing • Cambridge • Farnham • Kln • Paris • Sebastopol • Taipei • Tokyo Table of Contents Preface xiii 1. Strings 1 1.1 Concatenating (Joining) Strings 4 1.2 Improving String Handling Performance 6 1.3 Accessing Substrings 7 1.4 Changing String Case 8 1.5 Testing Equality of Two Strings 9 1.6 Testing String Containment Without Regular Expressions 11 1.7 Testing String Containment with Regular Expressions 13 1.8 Searching and Replacing Substrings 14 1.9 Using Special and Escaped Characters 15 1.10 Reading and Writing Strings for Cookies 17 1.11 Converting Between Unicode Values and String Characters 20 1.12 Encoding and Decoding URL Strings 21 1.13 Encoding and Decoding Base64 Strings 23 2. Numbers and Dates 27 2.1 Converting Between Numbers and Strings 31 2.2 Testing a Number's Validity 33 2.3 Testing Numeric Equality 34 2.4 Rounding Floating-Point Numbers 35 2.5 Formatting Numbers for Text Display 36 2.6 Converting Between Decimal and Hexadecimal Numbers 39 2.7 Generating Pseudorandom Numbers 41 2.8 Calculating Trigonometric Functions 41 2.9 Creating a Date Object 42 2.10 Calculating a Previous or Future Date 43 2.11 Calculating the Number of Days Between Two Dates 45 2.12 Validating a Date 47 3. Arrays and Objects 51 3.1 Creating a Simple Array 54 3.2 Creating a Multidimensional Array 56 3.3 Converting Between Arrays and Strings 57 3.4 Doing Something with the Items in an Array 59 3.5 Sorting a Simple Array 61 3.6 Combining Arrays 63 3.7 Dividing Arrays 64 3.8 Creating a Custom Object 65 3.9 Simulating a Hash Table for Fast Array Lookup 69 3.10 Doing Something with a Property of an Object 71 3.11 Sorting an Array of Objects 72 3.12 Customizing an Object's Prototype 74 3.13 Converting Arrays and Custom Objects to Strings 79 3.14 Using Objects to Reduce Naming Conflicts 82 4.
    [Show full text]
  • Danny Goodman's Applescript Handbook: MAC OS X Edition 2005
    Danny Goodman's AppleScript Handbook: MAC OS X Edition 2005 Spiderworks, 2005 Danny Goodman's AppleScript Handbook: MAC OS X Edition 2005 0974434493, 9780974434490 file download mahal.pdf 460 pages AppleScript for Applications Computers Ethan Wilde Offers a tutorial for using Apple's scripting language to increase productivity, script workflow projects, build custom graphics, and integrate data from FileMaker Pro 2001 ISBN:0201716135 OS Danny Goodman's AppleScript Handbook: MAC OS X Edition pdf file The Definitive Guide ISBN:0596005571 Computers 453 pages 2003 AppleScript Explains how use AppleScript, the native scripting language for Macintosh, to automate a variety of daily computing tasks and workflow processes, explaining how to interpret Matt Neuburg ISBN:0679790268 Danny Goodman 1990 The complete HyperCard 2.0 handbook 892 pages Computers Danny Goodman's AppleScript Handbook: MAC OS X Edition download Computers 1993 AppleScript Language Guide 380 pages ISBN:0201407353 English Dialect Apple's definitive guide to the powerful AppleScript scripting language, thisbook provides essential information for Macintosh power users and programmerswho want to use "More than a publishing phenomenon, Dummies is a sign of the times." The New York Times "We only buy software that has a For Dummies book to help us learn." Dennis Computers Tom Trinko AppleScript For Dummies ISBN:1568849753 Jan 4, 1996 396 pages Danny pdf download Computers ISBN:0201883562 1996 436 pages "FileMaker Pro, the most popular database program for the Macintosh, is now one of the few cross-platform, relational databases that's also easy to use. Whether you're just Charles Rubin The Macintosh Bible Guide to FileMaker Pro 3 X pdf file 673 pages UOM:39076001316889 Jan 1, 1986 Microsoft BASIC for the Macintosh Manual for Novices as Well as Experienced Programmers.
    [Show full text]
  • Solutions & Examples for Web Programmers
    Solutions & Examples for Web Programmers JavaScript & DHTML Cookbook Danny Goodman JavaScript and DHTML Cookbook JavaScript and DHTML Cookbook Danny Goodman Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo CHAPTERChapter 10 10 Page Navigation Techniques 10.0 Introduction No web page is (or should be) an island. Just as there is a way to reach the page, so should there be one or more ways to navigate to other destinations, either within the same site or outside. The HTML hyperlink element—embedded in pages as the rather nondescript <a> tag—is the conventional, nonscripted way to provide a click- able avenue for the user to navigate to another page. But more sophisticated user interface designs frequently require Dynamic HTML to assist with the presentation of navigation options and the very act of navigating. The location Object Each window (and frame) object in every scriptable browser has a location object whose properties contain information about the URL of the page currently loaded into the browser. This is an abstract object, meaning that the object has no particu- lar physical presence visible on the page—except perhaps the URL that appears in the browser’s Location or Address field. But the location object does not control what the user sees in the Location/Address field unless the browser succeeds in navi- gating to a page you assign to the location object. Properties of the location object are read/write. The individual properties reveal components of the URL (and even the entire URL) of the loaded page. Without any restrictions to this information, however, scripts could spy on your browser activity without you knowing it.
    [Show full text]