- Page 1 and 2:
JavaScript 2.0-The Complete Referen
- Page 3 and 4:
JavaScript 2.0-The Complete Referen
- Page 5 and 6:
Serrato, Darlene Hernandez, Michele
- Page 7 and 8:
First JavaScript document.write("
- Page 9 and 10:
In this case, the tag happens to s
- Page 11 and 12:
Ready start alert("First Script
- Page 13 and 14:
Script Hiding Most browsers tend to
- Page 15 and 16:
alert("Your JavaScript is on!
- Page 17 and 18:
- Page 19 and 20:
Event Trigger Example A re
- Page 21 and 22:
Notice that the src attribu
- Page 23 and 24:
Figure 1-6: JavaScript console used
- Page 25 and 26:
Table 1-1: Browser Versions and Jav
- Page 27 and 28:
A scripting language is a language
- Page 29 and 30:
This is not a problem in itself. Th
- Page 31 and 32:
y a linebreak without causing an er
- Page 33 and 34:
Being weakly typed is both a blessi
- Page 35 and 36:
myArray[1] = 5; myArray[2] = "Thoma
- Page 37 and 38:
To compare objects, JavaScript prov
- Page 39 and 40:
} else { } x = x + 1; First, the co
- Page 41 and 42:
do { document.write(x); document.wr
- Page 43 and 44:
This code declares a function named
- Page 45 and 46:
document.write("This text is no
- Page 47 and 48:
*/ invoke it as follows: var y = sq
- Page 49 and 50:
Part II: Core Language Chapter 3: D
- Page 51 and 52:
throughout both the chapter and the
- Page 53 and 54:
The other important special value i
- Page 55 and 56:
Things get really messy if you work
- Page 57 and 58:
Close examination of the table of e
- Page 59 and 60:
document.write("Note how newlines (
- Page 61 and 62:
Note Some Netscape browsers do not
- Page 63 and 64:
Methods of objects are accessed in
- Page 65 and 66:
The typeof Operator If you‘re cur
- Page 67 and 68:
Number "NaN", "0", or the string re
- Page 69 and 70:
A variable‘s name should give som
- Page 71 and 72:
execute. This context contains the
- Page 73 and 74:
} function innerFunction() { } aler
- Page 75 and 76:
context, the interpreter would firs
- Page 77 and 78:
y = y - 1 is fine. But if you make
- Page 79 and 80:
Operators JavaScript supports a var
- Page 81 and 82:
There is one further wrinkle with t
- Page 83 and 84:
Table 4-3 shows the bitwise operato
- Page 85 and 86:
Table 4-5: Shorthand Assignment wit
- Page 87 and 88:
Comparison Operators A comparison e
- Page 89 and 90:
"thomas" >> "fritz" "aaaa" >> "a" "
- Page 91 and 92:
var a,b,c,d; a = (b=5, c=7, d=56);
- Page 93 and 94:
alert(myArray[2]); alert(myArray[3]
- Page 95 and 96:
Table 4-9: Precedence and Associati
- Page 97 and 98:
JavaScript supports a core set of s
- Page 99 and 100:
else if (expression2) statement or
- Page 101 and 102:
Figure 4-1: Logical expressions can
- Page 103 and 104:
else if (yourGrade == 'D') alert("N
- Page 105 and 106:
} case 'C': alert("You passed!"); c
- Page 107 and 108:
{ } // do something Last, an import
- Page 109 and 110:
document.write("Start the countdown
- Page 111 and 112:
} document.write("Outerloop: "+i+""
- Page 113 and 114:
The with statement indicates an obj
- Page 115 and 116:
alter program flow. A variety of lo
- Page 117 and 118:
Functions do not have to receive on
- Page 119 and 120:
Functions always return some form o
- Page 121 and 122:
document.write("In function fiddle
- Page 123 and 124:
} x = 7; document.write("x="+x+"");
- Page 125 and 126:
However, more likely, we purposeful
- Page 127 and 128:
document.write("Entering testFuncti
- Page 129 and 130:
"statements for function body"); As
- Page 131 and 132:
A similar kind of nameless function
- Page 133 and 134:
The result shown next demonstrates
- Page 135 and 136:
Note that this isn‘t a terribly r
- Page 137 and 138:
Using Functions Before concluding t
- Page 139 and 140:
} if (addTwo.arguments.length == 2)
- Page 141 and 142:
familiar to anyone who has programm
- Page 143 and 144:
creates String objects while the Ar
- Page 145 and 146:
The result is As you can see, the s
- Page 147 and 148:
Figure 6-1: Enumerating properties
- Page 149 and 150:
statement; Using with lets you refe
- Page 151 and 152:
Declare a function taking two argum
- Page 153 and 154:
Table 6-2: Properties and Methods C
- Page 155 and 156:
Notice that we named the method att
- Page 157 and 158:
If the way the robot object has bee
- Page 159 and 160:
Object-Oriented JavaScript Before j
- Page 161 and 162:
} this.hasJetpack = true; This exam
- Page 163 and 164:
function Robot(flying, action) { }
- Page 165 and 166:
var feature = guard.feature; var ca
- Page 167 and 168:
var firstArray = []; var secondArra
- Page 169 and 170:
The effect is as if no element had
- Page 171 and 172:
var myValues = new Array(); myValue
- Page 173 and 174:
stack.pop(); // ["first", 10] Retur
- Page 175 and 176:
Unlike with the push() and shift()
- Page 177 and 178:
It takes a variable number of argum
- Page 179 and 180:
If you want to be more succinct, yo
- Page 181 and 182:
} { } var last = this[this.length-1
- Page 183 and 184:
Table 7-1: Arguments to the Date()
- Page 185 and 186:
document.write("The current date :
- Page 187 and 188:
If you are not sure whether the par
- Page 189 and 190:
Table 7-2: Globally Available Metho
- Page 191 and 192:
Table 7-4: Methods Provided by the
- Page 193 and 194:
var s = new String(); var headline
- Page 195 and 196:
var s = "JavaScript" + " is" + " a"
- Page 197 and 198:
Table 7-6: HTML-Releated String Met
- Page 199 and 200:
This chapter is an introduction to
- Page 201 and 202:
expressions are designed to be very
- Page 203 and 204:
These characters are ^ and $, indic
- Page 205 and 206:
Table 8-2: Regular Expression Escap
- Page 207 and 208:
var pattern = /ab+c/; is read as
- Page 209 and 210:
var pattern = /[0-9]+/; This regula
- Page 211 and 212:
would match ―abcx7d‖ or ―abc_
- Page 213 and 214:
You could use the following regular
- Page 215 and 216:
document.writeln("result.lastIndex
- Page 217 and 218:
} // if we have a match, print info
- Page 219 and 220:
Table 8-7: Static Properties of the
- Page 221 and 222:
var stringwithdelimits = "10 / 3 /
- Page 223 and 224:
Non-capturing Parentheses JavaScrip
- Page 225 and 226:
addresses instead of domain names (
- Page 227 and 228:
1. The core JavaScript language (e.
- Page 229 and 230:
For the sake of brevity, some detai
- Page 231 and 232:
""); document.write("Page Colors");
- Page 233 and 234:
- Page 235 and 236:
Figure 9-4: Some Document propertie
- Page 237 and 238:
using the traditional JavaScript
- Page 239 and 240:
The onclick attribute of the tag
- Page 241 and 242:
{ } var theirname=document.myForm.u
- Page 243 and 244:
Greeting: The previous examp
- Page 245 and 246:
Table 9-4: New Document Properties
- Page 247 and 248:
Netscape 4 Layer Example An example
- Page 249 and 250:
Figure 9-8: Internet Explorer 4 obj
- Page 251 and 252:
finds tag with id or name = myHeadi
- Page 253 and 254:
Table 9-7: Some New Properties for
- Page 255 and 256:
onclick="document.all['heading1'].s
- Page 257 and 258:
style, and content) to a programmin
- Page 259 and 260:
var feature; var version; for (i=0;
- Page 261 and 262:
The most important thing to think a
- Page 263 and 264:
Before moving on, we need to introd
- Page 265 and 266:
Table 10-2: DOM Node Properties DOM
- Page 267 and 268:
currentElement = currentElement.fir
- Page 269 and 270:
DOM Test Heading
- Page 271 and 272:
} } else alert("No parent"); break;
- Page 273 and 274:
onclick="currentElement=document.do
- Page 275 and 276:
Collection Description >document.an
- Page 277 and 278:
the necessary references. Let‘s s
- Page 279 and 280:
} if (node.parentNode) { } //-->> i
- Page 281 and 282:
- Page 283 and 284:
} function doReplace() { } var repl
- Page 285 and 286:
Table 10-5: Text Node Manipulation
- Page 287 and 288:
onclick="temp = textNode.splitText(
- Page 289 and 290:
7
- Page 291 and 292:
- Page 293 and 294:
-->> Simple DOM HTML Editor &n
- Page 295 and 296:
It would be easy enough to mod
- Page 297 and 298:
Table 10-6: CSS Property-to-DOM Pro
- Page 299 and 300:
"http://www.w3.org/TR/xhtml1/DTD/xh
- Page 301 and 302:
Style: normal italic oblique Wei
- Page 303 and 304:
onchange="theElement.style.fontSize
- Page 305 and 306:
Height: Width: &nbs
- Page 307 and 308:
theElement = document.getElementByI
- Page 309 and 310:
This is a paragraph This is a parag
- Page 311 and 312:
override them with local rules. Und
- Page 313 and 314:
} if (styleSheet.cssRules[0]) { } s
- Page 315 and 316:
There are a few things to study car
- Page 317 and 318:
var myWalker = document.createTreeW
- Page 319 and 320:
While the Traversal API is not wide
- Page 321 and 322:
adding content to the document. Bec
- Page 323 and 324:
inner/outer Tester This is a t
- Page 325 and 326:
>
- Page 327 and 328:
Figure 10-6: Using document.all[] a
- Page 329 and 330:
some consistency to the mad world t
- Page 331 and 332:
Table 11-2: Basic Events and Their
- Page 333 and 334:
ondblclick: onfocus: onkeydown:
- Page 335 and 336:
Browsers might support events othe
- Page 337 and 338:
onbeforedeactivate Fires just befor
- Page 339 and 340:
oncut Fires when selected content i
- Page 341 and 342:
ondrop Fires on a valid drop target
- Page 343 and 344:
onpropertychange Fires whenever a p
- Page 345 and 346:
page Non-standard Event Binding in
- Page 347 and 348:
this is to assign handlers after th
- Page 349 and 350:
Table 11-4: Effect of Returning fal
- Page 351 and 352:
- Page 353 and 354:
One major difference between versio
- Page 355 and 356:
if you check your JavaScript consol
- Page 357 and 358:
To set up event capturing, use the
- Page 359 and 360:
keep tabs on what happened to an ev
- Page 361 and 362:
We may be in the gutter, but some o
- Page 363 and 364:
Table 11-9: Behavior of Internet Ex
- Page 365 and 366:
Table 11-9: Behavior of Internet Ex
- Page 367 and 368:
Preventing Bubbling You can stop ev
- Page 369 and 370:
The DOM2 Event model specification
- Page 371 and 372:
document.getElementById('myText').r
- Page 373 and 374:
Alt Key down? Control Key down? M
- Page 375 and 376:
The result of a click is shown in
- Page 377 and 378:
when the user activates the pull-do
- Page 379 and 380:
function killClicks(event) { } even
- Page 381 and 382:
-->> The killClick handler is regi
- Page 384 and 385:
startListen(); //-->> Current Nod
- Page 386 and 387:
Table 11-18 summarizes the major fe
- Page 388 and 389:
Part IV: Using JavaScript Chapter 1
- Page 390 and 391:
window.confirm(string); or simply c
- Page 392 and 393:
value that contains the value enter
- Page 394 and 395:
Opening and Closing Generic Windows
- Page 397 and 398:
in some browsers, while others may
- Page 399 and 400:
Table 12-1: Feature Parameter Value
- Page 401 and 402:
featurestring += "width="+document.
- Page 403 and 404: Left: (IE) ScreenX: ScreenY: (Ne
- Page 405 and 406: Figure 12-1: Simple window and its
- Page 407 and 408: } } //-->> else customAlert("Bor
- Page 409 and 410: } } myWindow.focus(); // Make the w
- Page 411 and 412: windowHTML += ""; windowHTML += "An
- Page 413 and 414: windowname is the name of the windo
- Page 415 and 416: function moveIt() { if ((window.myW
- Page 417 and 418: myWindow.moveBy(0,10);" />> X: Y:
- Page 419 and 420: It is also possible to access parse
- Page 421 and 422: 5,4,3,2,1...BOOM Browser Self-De
- Page 423 and 424: message = message.substring(1, mess
- Page 425 and 426: Event Description onafterprint Even
- Page 427 and 428: parent.frames[0].name would print o
- Page 429 and 430: " var i = 0; msg += "Window: "+ win
- Page 431 and 432: Two Frames within the naviga
- Page 433 and 434: While inline frames seem to be a si
- Page 435 and 436: window.onload = frameBuster; // -->
- Page 437 and 438: Variables
- Page 439 and 440: Back to previous page While Ja
- Page 441 and 442: "http://www.w3.org/TR/xhtml1/DTD/xh
- Page 443 and 444: Interested readers are enc
- Page 445 and 446: Table 13-1: Document Properties Rel
- Page 447 and 448: Unvisited Link Click to show active
- Page 449 and 450: Location and Related Properties The
- Page 451 and 452: str += "but remember the rules of X
- Page 453: You also can read the target proper
- Page 457 and 458: Figure 13-3: Example Image properti
- Page 459 and 460: onclick="showProps(document.images[
- Page 461 and 462: Table 13-3: DOM Level 1 Document Pr
- Page 463 and 464: Table 13-5: Common DOM HTMLElement
- Page 465 and 466: Table 13-7: (X)HTML Elements Associ
- Page 467 and 468: Table 13-7: (X)HTML Elements Associ
- Page 469 and 470: Simple DOM Editor 0.2
- Page 471 and 472: It would be quite laborious and re
- Page 473 and 474: Robots Trainer Robot TR-4
- Page 475 and 476: Alignment: left center right Back
- Page 477 and 478: this.value;" />> Cell Padding: Cel
- Page 479 and 480: notice is that while it is easy to
- Page 481 and 482: Cell 2 Cell 3 Cell 4
- Page 483 and 484: } var numberRowsInTable = theTable.
- Page 485 and 486: Row #: Row #: Column #: Row #:
- Page 487 and 488: You might wonder what to do with th
- Page 489 and 490: There are also many possibilities w
- Page 491 and 492: Table 14-1: Major Properties of the
- Page 493 and 494: Password: Form Object Properti
- Page 495 and 496: Form Fields HTML supports a variety
- Page 497 and 498: method. Similarly, like all input e
- Page 499 and 500: src="../images/button.gif" alt="Sub
- Page 501 and 502: The following example shows the use
- Page 503 and 504: Common Field Properties > document
- Page 505 and 506:
Textarea 1: This is some default t
- Page 507 and 508:
document.write("type: "+document.te
- Page 509 and 510:
} } field.value = revertField; //--
- Page 511 and 512:
Collections of Checkboxes and Radio
- Page 513 and 514:
- Page 515 and 516:
Field Properties
- Page 517 and 518:
File upload fields have one extra p
- Page 519 and 520:
obtained. For example, given a cal
- Page 521 and 522:
Table 14-11: Additional Properties
- Page 523 and 524:
Vacation Chooser Country: > Aust
- Page 525 and 526:
In a standards-support browser such
- Page 527 and 528:
Table 14-14: The Extra Property Sup
- Page 529 and 530:
The previous example suffers fro
- Page 531 and 532:
} } document.myform.userpass.focus(
- Page 533 and 534:
} } return false; positionOfAt = s.
- Page 535 and 536:
} if (s.charAt(i) == "-") i++; for
- Page 537 and 538:
validations[0]=["document.myform.us
- Page 539 and 540:
} if (!(/^-?\d+$/.test(s))) { } ale
- Page 541 and 542:
action="http://www.javascriptref.co
- Page 544 and 545:
Keyboard Masking We‘ve seen how t
- Page 546 and 547:
In this script, we detect the ke
- Page 548 and 549:
First Name: In this example, a
- Page 550 and 551:
Color: Silver Green Red Blue Orang
- Page 552 and 553:
function isNumberInput(field, event
- Page 554 and 555:
} } //-->> widgettotal.value = form
- Page 556 and 557:
Subtotal: Tax: Next day: 2-day:
- Page 558 and 559:
Table 15-1: Properties of Image Obj
- Page 560 and 561:
Image Properties Left: Right:
- Page 562 and 563:
Vspace: Width:
- Page 564 and 565:
other event occurs on it. For examp
- Page 566 and 567:
width="90" height="90" alt="rollove
- Page 568 and 569:
function mouseOff() { } if (documen
- Page 570 and 571:
{ } if (document.images) document[i
- Page 572 and 573:
var homeon = preloadImage("homeon.g
- Page 574 and 575:
However, such cut-and-paste or fill
- Page 576 and 577:
} /* Turns the given image off and
- Page 578 and 579:
"http://www.w3.org/TR/xhtml1/DTD/xh
- Page 580 and 581:
For many, a major perceived downsid
- Page 582 and 583:
Table 15-3: Useful Layer Object Pro
- Page 584 and 585:
Once we know what kind of layer-awa
- Page 586 and 587:
} var theLayer = getElement(layerNa
- Page 588 and 589:
} if (layerobject) { } theLayer.doc
- Page 590 and 591:
* hide the layer with id = layerNam
- Page 592 and 593:
} theLayer.style.top=y+"px"; /* set
- Page 594 and 595:
{ var theLayer = getElement(layerNa
- Page 596 and 597:
I am positioned! background-color:
- Page 598 and 599:
ottom: right: > Note If you
- Page 600 and 601:
} } } /* set resize handler */ onre
- Page 602 and 603:
} // If they previously clicked, sw
- Page 604 and 605:
if (document.attachEvent) document.
- Page 606 and 607:
First, notice that we assigned the
- Page 608 and 609:
Mouse over any of the text below an
- Page 610 and 611:
As you can see in Figure 15-5, th
- Page 612 and 613:
} alert("The paragraph's actual t
- Page 614 and 615:
top:0px; layer-background-color:red
- Page 616 and 617:
} /* cover the screen with the laye
- Page 618 and 619:
CSS Rollover Message
- Page 620 and 621:
function getY(layerName) { } var th
- Page 622 and 623:
UFO!
- Page 624 and 625:
} if (currentY >> maxtop) { } else
- Page 626 and 627:
} { } else //-->> currentX+=step; s
- Page 628 and 629:
DHTML capabilities of modern browse
- Page 630 and 631:
Yahoo! News AlterNet AllAfrica
- Page 632 and 633:
var possibleNewLocation = pulldown[
- Page 634 and 635:
Figure 16-2: An improved pull-down
- Page 636 and 637:
function show(menuName) { } if (DOM
- Page 638 and 639:
} } var theMenu = document.getEleme
- Page 640 and 641:
JavaScriptRef
- Page 642 and 643:
var remoteControlURL = "remotecontr
- Page 644 and 645:
The most important thing
- Page 646 and 647:
- Page 648:
else move it 5 more pixels out left
- Page 651 and 652:
Static Menu Example > border-width
- Page 653 and 654:
This is the menu content. Welcome
- Page 655 and 656:
It is interesting that context menu
- Page 657 and 658:
When a user connects to a site, the
- Page 659 and 660:
{ var name, value; var beginning, m
- Page 661 and 662:
As you can see, it is possible for
- Page 663 and 664:
} } else { } var expiration = new D
- Page 665 and 666:
var name, value; var beginning, mid
- Page 667 and 668:
{ } document.cookie = "cookiesenabl
- Page 669 and 670:
One other issue to be aware of is t
- Page 671 and 672:
work in all types of browsers under
- Page 673 and 674:
Browser Detect Example > So
- Page 675 and 676:
else if (gecko) // -->> document.wr
- Page 677 and 678:
JavaScript support is probably the
- Page 679 and 680:
window.location="scripton.html"; //
- Page 681 and 682:
to detect if Internet Explorer is i
- Page 683 and 684:
Common Screen Properties Curren
- Page 685 and 686:
Available Height: Available Width
- Page 687:
In browsers that permit manipulatio
- Page 690 and 691:
Language Detection The final form o
- Page 692 and 693:
document.write("Color Depth: " + oC
- Page 694 and 695:
moments. Yet we can even go beyond
- Page 696 and 697:
if ((window.netscape) && (window.ne
- Page 698 and 699:
great deal of sophistication involv
- Page 700 and 701:
There is a lot of theory that goes
- Page 702 and 703:
Assuming that this applet is the fi
- Page 704 and 705:
- Page 706 and 707:
to drive an embedded applet is that
- Page 708 and 709:
are very often used together in ord
- Page 710 and 711:
document.write(''); document.write(
- Page 712 and 713:
Figure 18-5: Example contents of th
- Page 714 and 715:
Simple Flash control example (Netsc
- Page 716 and 717:
} if (document.demo.IsPlaying()) do
- Page 718 and 719:
The example—stopped in the midd
- Page 720 and 721:
Cross-Browser Inclusion of Embedded
- Page 722 and 723:
((navigator.plugins["Shockwave Flas
- Page 724 and 725:
} document.demo.Rewind(); function
- Page 726 and 727:
method="get">> (greater than
- Page 728 and 729:
One-Way Communication The simplest
- Page 730 and 731:
Note Don’t think that because we
- Page 732 and 733:
communicate messages to your JavaSc
- Page 734 and 735:
} // Else image has downloaded, so
- Page 736 and 737:
} // Wait until the image downloads
- Page 738 and 739:
Fetching news stories... var co
- Page 740 and 741:
Figure 19-1: Unlikely news from Jav
- Page 742 and 743:
} rpcComplete = false; var newScrip
- Page 744 and 745:
pcResult = true; If you enter a mis
- Page 746 and 747:
In this new incarnation the server-
- Page 748 and 749:
function send(sendValue) { var newL
- Page 750 and 751:
Table 19-1: Properties and Methods
- Page 752 and 753:
POSTs You can POST form data to a s
- Page 754 and 755:
Writing simple XML documents is fai
- Page 756 and 757:
Z, a-z), numbers (0-9), hyphens (-)
- Page 758 and 759:
size (small | medium | large) #REQU
- Page 760 and 761:
one. Fortunately, although not appa
- Page 762 and 763:
Look formatting XML as HTML The e
- Page 764 and 765:
Samantha Jones Sales Executive (54
- Page 766 and 767:
Employee Directory DemoCompany D
- Page 768 and 769:
The previous discussion only begins
- Page 770 and 771:
Widget Washer (543) 555-1212 fbrown
- Page 772 and 773:
Note This example requires the
- Page 774 and 775:
Email Note This example
- Page 776 and 777:
XML Demo
- Page 778 and 779:
XML Demo
- Page 780 and 781:
newEmployee.appendChild(newPhone);
- Page 782 and 783:
} } else } // get the children var
- Page 784 and 785:
onclick="deleteLastElement();docume
- Page 786 and 787:
Fred Brown Widget Washer (543) 555-
- Page 788 and 789:
Widget Washer (543) 555-1212 fbrown
- Page 790 and 791:
File: mozillaxmldemo.js function de
- Page 792 and 793:
} newPhone.appendChild(newPhoneText
- Page 794 and 795:
DemoCompany Directory Na
- Page 796 and 797:
* create child elements and text va
- Page 798 and 799:
Besides data islands, you will fi
- Page 800 and 801:
When the response is received we ca
- Page 802 and 803:
equest.open("GET",feedURL,false); r
- Page 804 and 805:
Simple JavaScript RSS Reader RS
- Page 806 and 807:
Part VI: Real World JavaScript Chap
- Page 808 and 809:
JScript 1.0 in Internet Explorer 3.
- Page 810 and 811:
Or if you were still concerned abou
- Page 812 and 813:
Enumerator Example Here's some te
- Page 814 and 815:
Table 21-6: Conditional Compilation
- Page 816 and 817:
A JScript 3+ browser processes the
- Page 818 and 819:
Table 21-8: Some Proprietary Featur
- Page 820 and 821:
-->>
- Page 822 and 823:
Table 21-10: Methods of JScript’s
- Page 824 and 825:
Don't bother with XHTML as an HTA i
- Page 826 and 827:
system resources, many users will (
- Page 828 and 829:
Letter Reminder This HT
- Page 830 and 831:
Table 21-11: Methods Used with Dyna
- Page 832 and 833:
We could get into trouble if the va
- Page 834 and 835:
emoveBehavior(). A simple example o
- Page 837 and 838:
it to be set as an element‘s attr
- Page 839 and 840:
There are two primary advantages th
- Page 841 and 842:
newpopup.document.body.style.paddin
- Page 843 and 844:
Table 21-14: Correspondence Between
- Page 845 and 846:
Table 21-16: Mozilla-Based Browsers
- Page 847 and 848:
Although Internet Explorer provides
- Page 849 and 850:
After 10 seconds, let's try to see
- Page 851 and 852:
Note Internet Explorer 5 allowed si
- Page 853 and 854:
Figure 22-1: Setting Mozilla’s ov
- Page 855 and 856:
Clicking the Custom Level button (s
- Page 857 and 858:
function you_are_it() { } tag(); ta
- Page 859 and 860:
Often sites will pop up windows or
- Page 861 and 862:
is a syntax error because the synta
- Page 863 and 864:
} Alternatively, the add() function
- Page 865 and 866:
Figure 23-3: Runtime errors in Inte
- Page 867 and 868:
Table 23-2: Common JavaScript Error
- Page 869 and 870:
(11), line 7, local variable inform
- Page 871 and 872:
} for (var i=0; i
- Page 873 and 874:
Once a script has been loaded into
- Page 875 and 876:
Now that we have covered some tools
- Page 877 and 878:
window.noSuchProperty(); // throw a
- Page 879 and 880:
Error: Your browser: Additional
- Page 881 and 882:
Property IE5? IE5.5+? Mozilla/NS6+?
- Page 883 and 884:
} // perform exception handling for
- Page 885 and 886:
} catch (theException) { } that is
- Page 887:
The key idea is that there are two
- Page 890 and 891:
} } //-->> // code to do something
- Page 892 and 893:
There are a variety of ways in whic
- Page 894 and 895:
Part VII: Appendixes Appendix A: Co
- Page 896 and 897:
Table A-5: Relationship Between Net
- Page 898 and 899:
Table A-8: Useful Numeric Constants
- Page 900 and 901:
Table A-15: Manual Type Conversion
- Page 902 and 903:
Table A-17: Properties of the Globa
- Page 904 and 905:
Table A-18: Binary (Two-Operand) an
- Page 906 and 907:
Table A-23: Binary Type Operators O
- Page 908 and 909:
Table A-25: Precedence and Associat
- Page 910 and 911:
If expression is omitted, the funct
- Page 912 and 913:
The break statement is used to exit
- Page 914 and 915:
Table A-26: JavaScript Exception Ob
- Page 916 and 917:
Table A-30: Regular Expression Char
- Page 918 and 919:
Figure B-1: The ―big picture‖ o
- Page 920 and 921:
Figure B-4: The Internet Explorer 3
- Page 922 and 923:
When describing methods and propert
- Page 924 and 925:
nodeType Read-only number holding t
- Page 926 and 927:
clearAttributes() Clears all noness
- Page 928 and 929:
insertAdjacentElement() for the mea
- Page 930 and 931:
name String containing the value of
- Page 932 and 933:
Supported in IE4+, MOZ/N6+, DOM1. N
- Page 934 and 935:
where the comma-separated values ar
- Page 936 and 937:
color String holding the default te
- Page 938 and 939:
gColor String specifying the backgr
- Page 940 and 941:
name String holding the name attrib
- Page 942 and 943:
dataSrc String containing the sourc
- Page 944 and 945:
provided in case programmers wish t
- Page 946 and 947:
getDay() Returns a numeric value in
- Page 948 and 949:
60, the minute is incremented by on
- Page 950 and 951:
eginning of this section. Access to
- Page 952 and 953:
fgColor String containing the font
- Page 954 and 955:
getElementById(id) Returns the elem
- Page 956 and 957:
This element has the methods listed
- Page 958 and 959:
Banner Related Advanced Stream Redi
- Page 960 and 961:
x Same as layerX in Netscape. In IE
- Page 962 and 963:
outeEvent(event) Passes the Event i
- Page 964 and 965:
Event Bubbles? Cancelable? mousemov
- Page 966 and 967:
ondatasetchanged Fires when the dat
- Page 968 and 969:
ShowBrowserUI(type,null) Opens a br
- Page 970 and 971:
length The number of entries in the
- Page 972 and 973:
var instanceName = new Function([ar
- Page 974 and 975:
Methods This object only has the me
- Page 976 and 977:
This object only supports the metho
- Page 978 and 979:
longDesc String specifying a URL fo
- Page 980 and 981:
This object only has the methods li
- Page 982 and 983:
load() Causes the browser to reload
- Page 984 and 985:
host String containing the host nam
- Page 986 and 987:
Tip Future versions of JavaScript w
- Page 988 and 989:
+ (addition) operator, 79, 80-81 ++
- Page 990 and 991:
application-like menus, DHTML, 510-
- Page 992 and 993:
Index_B B b object, HTMLElement, 77
- Page 994 and 995:
Navigator object, 536-539 overview
- Page 996 and 997:
Netscape extensions, 672-673 outerH
- Page 998 and 999:
commonly used, 201-202 negative, 20
- Page 1000 and 1001:
composite data types. See data type
- Page 1002 and 1003:
cssRules[ ] collection, 286 curly b
- Page 1004 and 1005:
Error object, 714-715 error reporti
- Page 1006 and 1007:
Style objects and, 489 division (/)
- Page 1008 and 1009:
dt, 801 em, 802 fieldset, 818 file,
- Page 1010 and 1011:
ul, 901 var, 902-903 document objec
- Page 1012 and 1013:
DOM Level 1 accessing elements, 263
- Page 1014 and 1015:
Java applets. see Java applets over
- Page 1016 and 1017:
eturn values, 312-314 scope, 311-31
- Page 1018 and 1019:
UI events, 336-337 exceptions, 718
- Page 1020 and 1021:
, 819 for loops overview of, 37-38
- Page 1022 and 1023:
same-origin policy and, 681 two-way
- Page 1024 and 1025:
grouping characters, regular expres
- Page 1026 and 1027:
em, 802 kbd, 833 noFrames, 846 noSc
- Page 1028 and 1029:
XMLHTTP, 597-600 Hypertext Markup L
- Page 1030 and 1031:
dynamic properties, 662-664 HTML ap
- Page 1032 and 1033:
, 421-423 buttons, 423-424 checkbox
- Page 1034 and 1035:
programming languages, 23-25 pseudo
- Page 1036 and 1037:
Netscape 4 and, 478-479 same-origin
- Page 1038 and 1039:
markup, browser detection, 539 marq
- Page 1040 and 1041:
MathML under, 616-617 the platform,
- Page 1042 and 1043:
netscape object, 852-853 new keywor
- Page 1044 and 1045:
IE document properties, 240-247 ini
- Page 1046 and 1047:
onblur event handlers, 426 onchange
- Page 1048 and 1049:
param object, HTMLParamElement, 853
- Page 1050 and 1051:
object-based, 33 relationship of Ja
- Page 1052 and 1053:
functions and, 116-117 objects and,
- Page 1054 and 1055:
eserved words definition of, 24 ide
- Page 1056 and 1057:
scope, variable, 70-73 scr attribut
- Page 1058 and 1059:
cross-site scripting and, 592 imple
- Page 1060 and 1061:
switch, 98-101 termination, 76-77 t
- Page 1062 and 1063:
submit( ) method, Form object, 418-
- Page 1064 and 1065:
ActiveX, 574 correspondence to text
- Page 1066 and 1067:
eturn values with, 92 Index_U U u o
- Page 1068 and 1069:
visual (Screen object), browser det
- Page 1070 and 1071:
WML (Wireless Markup Language), 603
- Page 1072 and 1073:
xmlns attribute, 616 xmp object, pr
- Page 1074 and 1075:
Chapter 7: Array, Date, Math, and T
- Page 1076 and 1077:
Chapter 16: Navigation and Site Vis
- Page 1078 and 1079:
Figure 23-9: Automatic error report
- Page 1080 and 1081:
Chapter 7: Array, Date, Math, and T
- Page 1082 and 1083:
Table 12-4: Common Window Propertie
- Page 1084 and 1085:
Table 21-15: Standards Support in M
- Page 1086:
Table C-2: Potentially Reserved Wor