-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathref_a-c.html
1450 lines (1189 loc) · 60.1 KB
/
ref_a-c.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<body>
<a name="alphabetical_list"><h1>Alphabetical list</h1></a>
<p>The following objects, methods, properties, and event handlers are available in JavaScript:
<table width="70%">
<tr valign="TOP">
<td>
<li><a href="ref_a-c.html#abs_method">abs</a>
<li><a href="ref_a-c.html#acos_method">acos</a>
<li><a href="ref_a-c.html#action_property">action</a>
<li><a href="ref_a-c.html#alert_method">alert</a>
<li><a href="ref_a-c.html#alinkColor_property">alinkColor</a>
<li><a href="ref_a-c.html#anchor_method">anchor</a>
<li><a href="ref_a-c.html#anchor_object">anchor (<i>anchors</i> array;)</a>
<li><a href="ref_a-c.html#anchors_property">anchors</a>
<li><a href="ref_a-c.html#appCodeName_property">appCodeName</a>
<li><a href="ref_a-c.html#appName_property">appName</a>
<li><a href="ref_a-c.html#appVersion_property">appVersion</a>
<li><a href="ref_a-c.html#asin_method">asin</a>
<li><a href="ref_a-c.html#atan_method">atan</a>
<li><a href="ref_a-c.html#back_method">back</a>
<li><a href="ref_a-c.html#bgColor_property">bgColor</a>
<li><a href="ref_a-c.html#big_method">big</a>
<li><a href="ref_a-c.html#blink_method">blink</a>
<li><a href="ref_a-c.html#blur_method">blur</a>
<li><a href="ref_a-c.html#bold_method">bold</a>
<li><a href="ref_a-c.html#button_object">button</a>
<li><a href="ref_a-c.html#ceil_method">ceil</a>
<li><a href="ref_a-c.html#charAt_method">charAt</a>
<li><a href="ref_a-c.html#checkbox_object">checkbox</a>
<li><a href="ref_a-c.html#checked_property">checked</a>
<li><a href="ref_a-c.html#clear_method">clear</a>
<li><a href="ref_a-c.html#clearTimeout_method">clearTimeout</a>
<li><a href="ref_a-c.html#click_method">click</a>
<li><a href="ref_a-c.html#close_document_method">close (document)</a>
<li><a href="ref_a-c.html#close_window_method">close (window)</a>
<li><a href="ref_a-c.html#confirm_method">confirm</a>
<li><a href="ref_a-c.html#cookie_property">cookie</a>
<li><a href="ref_a-c.html#cos_method">cos</a>
<li><a href="ref_d-e.html#Date_object">Date</a>
<li><a href="ref_d-e.html#defaultChecked_property">defaultChecked</a>
<li><a href="ref_d-e.html#defaultSelected_property">defaultSelected</a>
<li><a href="ref_d-e.html#defaultStatus_property">defaultStatus</a>
<li><a href="ref_d-e.html#defaultValue_property">defaultValue</a>
<li><a href="ref_d-e.html#document_object">document</a>
<li><a href="ref_d-e.html#E_property">E</a>
<li><a href="ref_d-e.html#elements_object"><i>elements</i> array;</a>
<li><a href="ref_d-e.html#elements_property">elements</a>
<li><a href="ref_d-e.html#encoding_property">encoding</a>
<li><a href="ref_d-e.html#escape_method">escape</a>
<li><a href="ref_d-e.html#eval_method">eval</a>
<li><a href="ref_d-e.html#exp_method">exp</a>
<li><a href="ref_f-g.html#fgColor_property">fgColor</a>
<li><a href="ref_f-g.html#fixed_method">fixed</a>
<li><a href="ref_f-g.html#floor_method">floor</a>
<li><a href="ref_f-g.html#focus_method">focus</a>
<li><a href="ref_f-g.html#fontcolor_method">fontcolor</a>
<li><a href="ref_f-g.html#fontsize_method">fontsize</a>
<li><a href="ref_f-g.html#form_object">form (<i>forms</i> array;)</a>
<li><a href="ref_f-g.html#forms_property">forms</a>
<li><a href="ref_f-g.html#forward_method">forward</a>
<li><a href="ref_f-g.html#frame_object">frame (<i>frames</i> array;)</a>
<li><a href="ref_f-g.html#frames_property">frames</a>
<li><a href="ref_f-g.html#getDate_method">getDate</a>
</td>
<td>
<li><a href="ref_f-g.html#getDay_method">getDay</a>
<li><a href="ref_f-g.html#getHours_method">getHours</a>
<li><a href="ref_f-g.html#getMinutes_method">getMinutes</a>
<li><a href="ref_f-g.html#getMonth_method">getMonth</a>
<li><a href="ref_f-g.html#getSeconds_method">getSeconds</a>
<li><a href="ref_f-g.html#getTime_method">getTime</a>
<li><a href="ref_f-g.html#getTimezoneOffset_method">getTimezoneOffset</a>
<li><a href="ref_f-g.html#getYear_method">getYear</a>
<li><a href="ref_f-g.html#go_method">go</a>
<li><a href="ref_h-l.html#hash_property">hash</a>
<li><a href="ref_h-l.html#hidden_object">hidden</a>
<li><a href="ref_h-l.html#history_object">history</a>
<li><a href="ref_h-l.html#host_property">host</a>
<li><a href="ref_h-l.html#hostname_property">hostname</a>
<li><a href="ref_h-l.html#href_property">href</a>
<li><a href="ref_h-l.html#index_property">index</a>
<li><a href="ref_h-l.html#indexOf_method">indexOf</a>
<li><a href="ref_h-l.html#isNaN_method">isNaN</a>
<li><a href="ref_h-l.html#italics_method">italics</a>
<li><a href="ref_h-l.html#lastIndexOf_method">lastIndexOf</a>
<li><a href="ref_h-l.html#lastModified_property">lastModified</a>
<li><a href="ref_h-l.html#length_property">length</a>
<li><a href="ref_h-l.html#link_method">link</a>
<li><a href="ref_h-l.html#link_object">link (<i>links</i> array;)</a>
<li><a href="ref_h-l.html#linkColor_property">linkColor</a>
<li><a href="ref_h-l.html#links_property">links</a>
<li><a href="ref_h-l.html#LN2_property">LN2</a>
<li><a href="ref_h-l.html#LN10_property">LN10</a>
<li><a href="ref_h-l.html#location_object">location</a>
<li><a href="ref_h-l.html#location_property">location</a>
<li><a href="ref_h-l.html#log_method">log</a>
<li><a href="ref_h-l.html#LOG2E_property">LOG2E</a>
<li><a href="ref_h-l.html#LOG10E_property">LOG10E</a>
<li><a href="ref_m-q.html#Math_object">Math</a>
<li><a href="ref_m-q.html#max_method">max</a>
<li><a href="ref_m-q.html#method_property">method</a>
<li><a href="ref_m-q.html#min_method">min</a>
<li><a href="ref_m-q.html#name_property">name</a>
<li><a href="ref_m-q.html#navigator_object">navigator</a>
<li><a href="ref_m-q.html#onBlur_event">onBlur</a>
<li><a href="ref_m-q.html#onChange_event">onChange</a>
<li><a href="ref_m-q.html#onClick_event">onClick</a>
<li><a href="ref_m-q.html#onFocus_event">onFocus</a>
<li><a href="ref_m-q.html#onLoad_event">onLoad</a>
<li><a href="ref_m-q.html#onMouseOver_event">onMouseOver</a>
<li><a href="ref_m-q.html#onSelect_event">onSelect</a>
<li><a href="ref_m-q.html#onSubmit_event">onSubmit</a>
<li><a href="ref_m-q.html#onUnload_event">onUnload</a>
<li><a href="ref_m-q.html#open_document_method">open (document)</a>
<li><a href="ref_m-q.html#open_window_method">open (window)</a>
<li><a href="ref_m-q.html#options_property">options</a>
<li><a href="ref_m-q.html#parent_property">parent</a>
<li><a href="ref_m-q.html#parse_method">parse</a>
<li><a href="ref_m-q.html#parseFloat_method">parseFloat</a>
<li><a href="ref_m-q.html#parseInt_method">parseInt</a>
<li><a href="ref_m-q.html#password_object">password</a>
<li><a href="ref_m-q.html#pathname_property">pathname</a>
</td>
<td>
<li><a href="ref_m-q.html#PI_property">PI</a>
<li><a href="ref_m-q.html#port_property">port</a>
<li><a href="ref_m-q.html#pow_method">pow</a>
<li><a href="ref_m-q.html#prompt_method">prompt</a>
<li><a href="ref_m-q.html#protocol_property">protocol</a>
<li><a href="ref_r-r.html#radio_object">radio</a>
<li><a href="ref_r-r.html#random_method">random</a>
<li><a href="ref_r-r.html#referrer_property">referrer</a>
<li><a href="ref_r-r.html#reset_object">reset</a>
<li><a href="ref_r-r.html#round_method">round</a>
<li><a href="ref_s-s.html#search_property">search</a>
<li><a href="ref_s-s.html#select_method">select</a>
<li><a href="ref_s-s.html#select_object">select (<i>options</i> array;)</a>
<li><a href="ref_s-s.html#selected_property">selected</a>
<li><a href="ref_s-s.html#selectedIndex_property">selectedIndex</a>
<li><a href="ref_s-s.html#self_property">self</a>
<li><a href="ref_s-s.html#setDate_method">setDate</a>
<li><a href="ref_s-s.html#setHours_method">setHours</a>
<li><a href="ref_s-s.html#setMinutes_method">setMinutes</a>
<li><a href="ref_s-s.html#setMonth_method">setMonth</a>
<li><a href="ref_s-s.html#setSeconds_method">setSeconds</a>
<li><a href="ref_s-s.html#setTime_method">setTime</a>
<li><a href="ref_s-s.html#setTimeout_method">setTimeout</a>
<li><a href="ref_s-s.html#setYear_method">setYear</a>
<li><a href="ref_s-s.html#sin_method">sin</a>
<li><a href="ref_s-s.html#small_method">small</a>
<li><a href="ref_s-s.html#sqrt_method">sqrt</a>
<li><a href="ref_s-s.html#SQRT1_2_property">SQRT1_2</a>
<li><a href="ref_s-s.html#SQRT2_property">SQRT2</a>
<li><a href="ref_s-s.html#status_property">status</a>
<li><a href="ref_s-s.html#strike_method">strike</a>
<li><a href="ref_s-s.html#string_object">string</a>
<li><a href="ref_s-s.html#sub_method">sub</a>
<li><a href="ref_s-s.html#submit_method">submit</a>
<li><a href="ref_s-s.html#submit_object">submit</a>
<li><a href="ref_s-s.html#substring_method">substring</a>
<li><a href="ref_s-s.html#sup_method">sup</a>
<li><a href="ref_t-z.html#tan_method">tan</a>
<li><a href="ref_t-z.html#target_property">target</a>
<li><a href="ref_t-z.html#text_object">text</a>
<li><a href="ref_t-z.html#text_property">text</a>
<li><a href="ref_t-z.html#textarea_object">textarea</a>
<li><a href="ref_t-z.html#title_property">title</a>
<li><a href="ref_t-z.html#toGMTString_method">toGMTString</a>
<li><a href="ref_t-z.html#toLocaleString_method">toLocaleString</a>
<li><a href="ref_t-z.html#toLowerCase_method">toLowerCase</a>
<li><a href="ref_t-z.html#top_property">top</a>
<li><a href="ref_t-z.html#toUpperCase_method">toUpperCase</a>
<li><a href="ref_t-z.html#unescape_method">unescape</a>
<li><a href="ref_t-z.html#userAgent_property">userAgent</a>
<li><a href="ref_t-z.html#UTC_method">UTC</a>
<li><a href="ref_t-z.html#value_property">value</a>
<li><a href="ref_t-z.html#vlinkColor_property">vlinkColor</a>
<li><a href="ref_t-z.html#window_object">window</a>
<li><a href="ref_t-z.html#window_property">window</a>
<li><a href="ref_t-z.html#write_method">write</a>
<li><a href="ref_t-z.html#writeln_method">writeln</a>
</td>
</tr>
</table>
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="abs_method"><h2>abs method</h2></a>
<p>Returns the absolute value of a number.
<h3>Syntax</h3>
<pre>Math.abs(<i>number</i>)</pre>
<p><i>number</i> is any numeric expression or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_m-q.html#Math_object">Math</a>
<h3>Examples</h3>
<p>In the following example, the user enters a number in the first text box and presses the Calculate button to display the absolute value of the number.
<pre>
<FORM;>
<P;>Enter; a number:
<INPUT; TYPE="text" NAME="absEntry">
<P;>The; absolute value is:
<INPUT; TYPE="text" NAME="result">
<P;>
<INPUT; TYPE="button" VALUE="Calculate"
onClick="form.result.value = Math.abs(form.absEntry.value)">
</FORM>
</pre>
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="acos_method"><h2>acos method</h2></a>
<p>Returns the arc cosine (in radians) of a number.
<h3>Syntax</h3>
<pre>Math.acos(<i>number</i>)</pre>
<p><i>number</i> is a numeric expression between -1 and 1, or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_m-q.html#Math_object">Math</a>
<h3>Description</h3>
<p>The acos method returns a numeric value between 0 and pi radians. If the value of <i>number</i> is outside the suggested range, the return value is always 0.
<h3>Examples</h3>
<pre>
// Displays the value 0
document.write("The arc cosine of 1 is " + Math.acos(1))
// Displays the value 3.141592653589793
document.write("<P;>The; arc cosine of -1 is " + Math.acos(-1))
// Displays the value 0
document.write("<P;>The; arc cosine of 2 is " + Math.acos(2))
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#asin_method">asin</a>, <a href="ref_a-c.html#atan_method">atan</a>, <a href="ref_a-c.html#cos_method">cos</a>, <a href="ref_s-s.html#sin_method">sin</a>, <a href="ref_t-z.html#tan_method">tan</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="action_property"><h2>action property</h2></a>
<p>
A string specifying a destination URL for form data that is submitted.
<h3>Syntax</h3>
<pre><i>formName</i>.action</pre>
<p><i>formName</i> is either the name of a form or an element in the <i>forms</i> array.
<h3>Property of</h3>
<p><a href="ref_f-g.html#form_object">form</a>
<h3>Description</h3>
<p>The action property is a reflection of the ACTION attribute of the <FORM;> tag. Each section of a URL contains different information. See the <a href="ref_h-l.html#location_object">location</a> object for a description of the URL components.
<p>You can set the action property at any time.
<p>Certain values of the action property may require specific values for other form properties. See <a href="https://web.archive.org/web/19970617232636/http://www.ics.uci.edu/pub/ietf/html/rfc1867.txt" target="_top">RFC 1867</a> for more information.
<h3>Examples</h3>
<p>The following example sets the action property of the <i>musicForm</i> form to the value of the variable <i>urlName</i>:
<pre>document.musicForm.action=urlName</pre>
<h3>See also</h3>
<li><a href="ref_d-e.html#encoding_property">encoding</a>, <a href="ref_m-q.html#method_property">method</a>, <a href="ref_t-z.html#target_property">target</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="alert_method"><h2>alert method</h2></a>
<p>
Displays an Alert dialog box with a message and an OK button.
<h3>Syntax</h3>
<pre>alert("<i>message</i>")</pre>
<p><i>message</i> is any string or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_t-z.html#window_object">window</a>
<h3>Description</h3>
<p>Use the alert method to display a message that does not require a user decision. The <i>message</i> argument specifies a message that the dialog box contains.
<p>Although alert is a method of the window object, you do not need to specify a <i>windowReference</i> when you call it. For example, <tt><i>windowReference</i>.alert()</tt> is unnecessary.
<h3>Examples</h3>
<p>In the following example, the <i>testValue()</i> function checks the name entered by a user in the text object of a form to make sure that it is no more than eight characters in length. This example uses the alert method to prompt the user to enter a valid value.
<pre>
function testValue(textElement) {
if (textElement.length > 8) {
alert("Please enter a name that is 8 characters or less")
}
}</pre>
You can call the <i>testValue()</i> function in the onBlur event handler of a form's text object, as shown in the following example:
<pre>Name: <INPUT; TYPE="text" NAME="userName"
onBlur="testValue(userName.value)"></pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#confirm_method">confirm</a>, <a href="ref_m-q.html#prompt_method">prompt</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="alinkColor_property"><h2>alinkColor property</h2></a>
<p>
A string specifying the color of an active link (after mouse-button down, but before mouse-button up).
<h3>Syntax</h3>
<pre>document.alinkColor</pre>
<h3>Property of</h3>
<p><a href="ref_d-e.html#document_object">document</a>
<h3>Description</h3>
<p>
The alinkColor property is expressed as a hexadecimal RGB triplet or as one of the string literals listed in <a href="colors.html">Color Values</a>. This property is the JavaScript reflection of the ALINK attribute of the <BODY;> tag. You cannot set this property after the HTML source has been through layout.
<p>If you express the color as a hexadecimal RGB triplet, you must use the format rrggbb. For example, the hexadecimal RGB values for salmon are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072".
<h3>Examples</h3>
<p>The following example sets the color of active links to aqua using a string literal:
<pre>
document.alinkColor="aqua"
</pre>
<p>The following example sets the color of active links to aqua using a hexadecimal triplet:
<pre>
document.alinkColor="00FFFF"
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#bgColor_property">bgColor</a>, <a href="ref_f-g.html#fgColor_property">fgColor</a>, <a href="ref_h-l.html#linkColor_property">linkColor</a>, and <a href="ref_t-z.html#vlinkColor_property">vlinkColor</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="anchor_method"><h2>anchor method</h2></a>
<p>
Creates an HTML anchor that is used as a hypertext target.
<h3>Syntax</h3>
<pre><i>text</i>.anchor(<i>nameAttribute</i>)</pre>
<p><i>text</i> is any string or a property of an existing object.
<br><i>nameAttribute</i> is any string or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_s-s.html#string_object">string</a>
<h3>Description</h3>
<p>Use the anchor method with the write or writeln methods to programatically create and display an anchor in a document. Create the anchor with the anchor method, then call write or writeln to display the anchor in a document.
<p>In the syntax, the <i>text</i> string represents the literal text that you want the user to see. The <i>nameAttribute</i> string represents the NAME attribute of the <A;> tag.
<p>Anchors created with the anchor method become elements in the anchors array. See the <a href="ref_a-c.html#anchor_object">anchor</a> object for information about the anchors array.
<h3>Examples</h3>
<p>The following example opens the <i>msgWindow</i> window and creates an anchor for the Table of Contents:
<xmp>
var myString="Table of Contents"
msgWindow=window.open("","displayWindow")
msgWindow.document.writeln(myString.anchor("contents_anchor"))
msgWindow.document.close()
</xmp>
<p>The previous example produces the same output as the following HTML:
<xmp>
<a name="contents_anchor">Table of Contents</a>
</xmp>
<h3>See also</h3>
<li><a href="ref_h-l.html#link_method">link</a> method
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="anchor_object"><h2>anchor object (<i>anchors</i> array)</h2></a>
<p>A piece of text that can be the target of a hypertext link.
<h3>Syntax</h3>
<p>To define an anchor, use standard HTML syntax:
<pre>
<A; [HREF=<i>locationOrURL</i>]
NAME="<i>anchorName</i>"
[TARGET="<i>windowName</i>"]>
<i>anchorText</i>
</A>
</pre>
<i>HREF=locationOrURL</i> identifies a destination anchor or URL. If this attribute is present, the anchor object is also a link object. See <a href="ref_h-l.html#link_object">link</a> for details.
<br><i>NAME="anchorName"</i> specifies a tag that becomes an available hypertext target within the current document.
<br><i>TARGET="windowName"</i> specifies the window that the link is loaded into. This attribute is meaningful only if <i>HREF=locationOrURL</i> is present. See <a href="ref_h-l.html#link_object">link</a> for details.
<br><i>anchorText</i> specifies the text to display at the anchor.
<p>You can also define an anchor using the <a href="ref_a-c.html#anchor_method">anchor</a> method.
<h3>Property of</h3>
<li><a href="ref_d-e.html#document_object">document</a>
<h3>Description</h3>
<p>If an anchor object is also a link object, the object has entries in both the <i>anchors</i> and <i>links</i> arrays.
<h4>The <i>anchors</i> array</h4>
<p>You can reference the anchor objects in your code by using the <i>anchors</i> array. This array contains an entry for each <A;> tag containing a NAME attribute in a document in source order. For example, if a document contains three named anchors, these anchors are reflected as <tt>document.anchors[0]</tt>, <tt>document.anchors[1]</tt>, and <tt>document.anchors[2]</tt>.
<p>To use the <i>anchors</i> array:
<pre>
1. document.anchors[<i>index</i>]
2. document.anchors.length
</pre>
<p><i>index</i> is an integer representing an anchor in a document.
<p>To obtain the number of anchors in a document, use the length property: <tt>document.anchors.length</tt>.
<p>Even though the <i>anchors</i> array represents named anchors, the value of anchors[<i>index</i>] is always null. But if a document names anchors in a systematic way using natural numbers, you can use the <i>anchors</i> array and its length property to validate an anchor name before using it in operations such as setting <tt>location.hash</tt>. See the example below.
<p>Elements in the <i>anchors</i> array are read-only. For example, the statement <tt>document.anchors[0]="anchor1"</tt> has no effect.
<h3>Properties</h3>
<p>The anchors object has no properties. The <i>anchors</i> array has the following properties:
<li><a href="ref_h-l.html#length_property">length</a> reflects the number of named anchors in a document
<h3>Methods</h3>
<li>None.
<h3>Event handlers</h3>
<li>None.
<h3>Examples</h3>
<p><b>Example 1: an anchor.</b> The following example defines an anchor for the text "Welcome to JavaScript".
<xmp>
<a name="javascript_intro"><h2>Welcome to JavaScript</h2></a>
</xmp>
<p>If the preceding anchor is in a file called intro.html, a link in another file could define a jump to the anchor as follows:
<xmp>
<a href="intro.html#javascript_intro">Introduction</a>
</xmp>
<p><b>Example 2: anchors array.</b> The following example opens two windows. The first window contains a series of buttons that set <tt>location.hash</tt> in the second window to a specific anchor. The second window defines four anchors named "0", "1", "2", and "3". (The anchor names in the document are therefore 0, 1, 2, ... (document.anchors.length-1)). When a button is pressed in the first window, the onClick event handler verifies that the anchor exists before setting <tt><i>window2</i>.location.hash</tt> to the specified anchor name.
<p>LINK1.HTML, which defines the first window and its buttons, contains the following code:
<xmp>
<html>
<head>
<title>Links and Anchors: Window 1</title>
</head>
<body>
<script>
window2=open("link2.html","secondLinkWindow","scrollbars=yes,width=250, height=400")
function linkToWindow(num) {
if (window2.document.anchors.length > num)
window2.location.hash=num
else
alert("Anchor does not exist!")
}
</script>
<b>Links and Anchors</b>
<form>
<p>Click a button to display that anchor in window #2
<p><input type="button" value="0" name="link0_button" onclick="linkToWindow(this.value)">
<input type="button" value="1" name="link0_button" onclick="linkToWindow(this.value)">
<input type="button" value="2" name="link0_button" onclick="linkToWindow(this.value)">
<input type="button" value="3" name="link0_button" onclick="linkToWindow(this.value)">
<input type="button" value="4" name="link0_button" onclick="linkToWindow(this.value)">
</form>
</body>
</html>
</xmp>
<p>LINK2.HTML, which contains the anchors, contains the following code:
<xmp>
<html>
<head>
<title>Links and Anchors: Window 2</title>
</head>
<body>
<a name="0"><b>Some numbers</b> (Anchor 0)</a>
<li>one
<li>two
<li>three
<li>four
<li>five
<li>six
<li>seven
<li>eight
<li>nine
<p><a name="1"><b>Some colors</b> (Anchor 1)</a>
<li>red
<li>orange
<li>yellow
<li>green
<li>blue
<li>purple
<li>brown
<li>black
<p><a name="2"><b>Some music types</b> (Anchor 2)</a>
<li>R&B;
<li>Jazz
<li>Soul
<li>Reggae
<li>Rock
<li>Country
<li>Classical
<li>Opera
<p><a name="3"><b>Some countries</b> (Anchor 3)</a>
<li>Afghanistan
<li>Brazil
<li>Canada
<li>Finland
<li>India
<li>Italy
<li>Japan
<li>Kenya
<li>Mexico
<li>Nigeria
</body>
</html>
</xmp>
<h3>See also</h3>
<li><a href="ref_h-l.html#link_object">link</a> object
<li><a href="ref_a-c.html#anchor_method">anchor</a> method
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="anchors_property"><h2>anchors property</h2></a>
<p>An array of objects corresponding to named anchors in source order. See <a href="ref_a-c.html#anchor_object">anchor</a> object.
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="appCodeName_property"><h2>appCodeName property</h2></a>
<p>A string specifying the code name of the browser.
<h3>Syntax</h3>
<pre>navigator.appCodeName</pre>
<h3>Property of</h3>
<p><a href="ref_m-q.html#navigator_object">navigator</a>
<h3>Description</h3>
<p>appCodeName is a read-only property.
<p>
<h3>Examples</h3>
<p>The following example displays the value of the appCodeName property:
<pre>document.write("The value of navigator.appCodeName is " +
navigator.appCodeName)</pre>
<p>For Navigator 2.0, this displays the following:
<pre>The value of navigator.appCodeName is Mozilla</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#appName_property">appName</a>, <a href="ref_a-c.html#appVersion_property">appVersion</a>, <a href="ref_t-z.html#userAgent_property">userAgent</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="appName_property"><h2>appName property</h2></a>
<p>
A string specifying the name of the browser.
<h3>Syntax</h3>
<pre>navigator.appName</pre>
<h3>Property of</h3>
<p><a href="ref_m-q.html#navigator_object">navigator</a>
<h3>Description</h3>
<p>appName is a read-only property.
<h3>Examples</h3>
<p>The following example displays the value of the appName property:
<pre>document.write("The value of navigator.appName is " +
navigator.appName)</pre>
<p>For Navigator 2.0, this displays the following:
<pre>The value of navigator.appName is Netscape</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#appVersion_property">appVersion</a>, <a href="ref_a-c.html#appCodeName_property">appCodeName</a>, <a href="ref_t-z.html#userAgent_property">userAgent</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="appVersion_property"><h2>appVersion property</h2></a>
<p>
A string specifying version information for the Navigator.
<h3>Syntax</h3>
<pre>navigator.appVersion</pre>
<h3>Property of</h3>
<p><a href="ref_m-q.html#navigator_object">navigator</a>
<h3>Description</h3>
<p>The appVersion property specifies version information in the following format:
<p><i>releaseNumber</i> (<i>platform</i>; <i>country</i>)
<p>The values contained in this format are the following:
<li><i>releaseNumber</i> is the version number of the Navigator. For example, "2.0b4" specifies Navigator 2.0, beta 4.
<li><i>platform</i> is the platform upon which the Navigator is running. For example, "Win16" specifies a 16-bit version of Windows such as Windows 3.11.
<li><i>country</i> is either "I" for the international release, or "U" for the domestic U.S. release. The domestic release has a stronger encryption feature than the international release.
<p>appVersion is a read-only property.
<h3>Examples</h3>
<p><b>Example 1.</b> The following example displays version information for the Navigator:
<pre>document.write("The value of navigator.appVersion is " +
navigator.appVersion)</pre>
<p>For Navigator 2.0 on Windows 95, this displays the following:
<pre>The value of navigator.appVersion is 2.0 (Win95, I)</pre>
<p><b>Example 2.</b> The following example populates a textarea object with newline characters separating each line. Because the newline character varies from platform to platform, the example tests the appVersion property to determine whether the user is running Windows (appVersion contains "Win" for all versions of Windows). If the user is running Windows, the newline character is set to \r\n; otherwise, it's set to \n, which is the newline character for Unix and Macintosh.
<xmp>
<script>
var newline=null
function populate(textareaObject){
if (navigator.appVersion.lastIndexOf('Win') != -1)
newline="\r\n"
else newline="\n"
textareaObject.value="line 1" + newline + "line 2" + newline + "line 3"
}
</script>
<form name="form1">
<br><textarea name="testLines" rows="8" cols="55"></textarea>
<p><input type="button" value="Populate the textarea object" onclick="populate(document.form1.testLines)">
</textarea>
</form>
</xmp>
<h3>See also</h3>
<li><a href="ref_a-c.html#appName_property">appName</a>, <a href="ref_a-c.html#appCodeName_property">appCodeName</a>, <a href="ref_t-z.html#userAgent_property">userAgent</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="asin_method"><h2>asin method</h2></a>
<p>
Returns the arc sine (in radians) of a number.
<h3>Syntax</h3>
<pre>Math.asin(<i>number</i>)</pre>
<p><i>number</i> is a numeric expression between -1 and 1, or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_m-q.html#Math_object">Math</a>
<h3>Description</h3>
<p>The asin method returns a numeric value between -pi/2 and pi/2 radians. If the value of <i>number</i> is outside the suggested range, the return value is always 0.
<h3>Examples</h3>
<pre>
// Displays the value 1.570796326794897 (pi/2)
document.write("The arc sine of 1 is " + Math.asin(1))
// Displays the value -1.570796326794897 (-pi/2)
document.write("<P;>The; arc sine of -1 is " + Math.asin(-1))
// Displays the value 0 because the argument is out of range
document.write("<P;>The; arc sine of 2 is " + Math.asin(2))
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#acos_method">acos</a>, <a href="ref_a-c.html#atan_method">atan</a>, <a href="ref_a-c.html#cos_method">cos</a>, <a href="ref_s-s.html#sin_method">sin</a>, <a href="ref_t-z.html#tan_method">tan</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="atan_method"><h2>atan method</h2></a>
<p>
Returns the arc tangent (in radians) of a number.
<h3>Syntax</h3>
<pre>Math.atan(<i>number</i>)</pre>
<p><i>number</i> is either a numeric expression or a property of an existing object, representing the tangent of an angle.
<h3>Method of</h3>
<p><a href="ref_m-q.html#Math_object">Math</a>
<h3>Description</h3>
<p>The atan method returns a numeric value between -pi/2 and pi/2 radians.
<h3>Examples</h3>
<pre>
// Displays the value 0.7853981633974483
document.write("The arc tangent of 1 is " + Math.atan(1))
// Displays the value -0.7853981633974483
document.write("<P;>The; arc tangent of -1 is " + Math.atan(-1))
// Displays the value 0.4636476090008061
document.write("<P;>The; arc tangent of .5 is " + Math.atan(.5))
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#acos_method">acos</a>, <a href="ref_a-c.html#asin_method">asin</a>, <a href="ref_a-c.html#cos_method">cos</a>, <a href="ref_s-s.html#sin_method">sin</a>, <a href="ref_t-z.html#tan_method">tan</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="back_method"><h2>back method</h2></a>
<p>
Loads the previous URL in the history list.
<h3>Syntax</h3>
<pre>history.back()</pre>
<h3>Method of</h3>
<p><a href="ref_h-l.html#history_object">history</a>
<h3>Description</h3>
<p>This method performs the same action as a user choosing the Back button in the Navigator. The back method is the same as <tt>history.go(-1)</tt>.
<h3>Examples</h3>
The following custom buttons perform the same operations as the Navigator Back and Forward buttons:
<pre>
<P;><INPUT; TYPE="button" VALUE="< Back"
onClick="history.back()">
<P;><INPUT; TYPE="button" VALUE="> Forward"
onClick="history.forward()">
</pre>
<h3>See also</h3>
<li><a href="ref_f-g.html#forward_method">forward</a>, <a href="ref_f-g.html#go_method">go</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="bgColor_property"><h2>bgColor property</h2></a>
<p>
A string specifying the color of the document background.
<h3>Syntax</h3>
<pre>document.bgColor</pre>
<h3>Property of</h3>
<p><a href="ref_d-e.html#document_object">document</a>
<h3>Description</h3>
<p>The bgColor property is expressed as a hexadecimal RGB triplet or as one of the string literals listed in <a href="colors.html">Color Values</a>. This property is the JavaScript reflection of the BGCOLOR attribute of the <BODY;> tag. The default value of this property is set by the user on the Colors tab of the Preferences dialog box, which is displayed by choosing General Preferences from the Options menu.
<p>You can set the bgColor property at any time.
<p>If you express the color as a hexadecimal RGB triplet, you must use the format rrggbb. For example, the hexadecimal RGB values for salmon are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072".
<h3>Examples</h3>
<p>The following example sets the color of the document background to aqua using a string literal:
<pre>
document.bgColor="aqua"
</pre>
<p>The following example sets the color of the document background to aqua using a hexadecimal triplet:
<pre>
document.bgColor="00FFFF"
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#alinkColor_property">alinkColor</a>, <a href="ref_f-g.html#fgColor_property">fgColor</a>, <a href="ref_h-l.html#linkColor_property">linkColor</a>, and <a href="ref_t-z.html#vlinkColor_property">vlinkColor</a> properties
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="big_method"><h2>big method</h2></a>
<p>
Causes a string to be displayed in a big font as if it were in a <BIG;> tag.
<h3>Syntax</h3>
<pre><i>stringName</i>.big()</pre>
<p><i>stringName</i> is any string or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_s-s.html#string_object">string</a>
<h3>Description</h3>
<p>Use the big method with the write or writeln methods to format and display a string in a document.
<h3>Examples</h3>
The following example uses string methods to change the size of a string:
<pre>
var worldString="Hello, world"
document.write(worldString.small())
document.write("<P;>" + worldString.big())
document.write("<P;>" + worldString.fontsize(7))
</pre>
<p>The previous example produces the same output as the following HTML:
<xmp>
<small>Hello, world</small>
<p><big>Hello, world</big>
<p><fontsize=7>Hello, world</fontsize>
</xmp>
<h3>See also</h3>
<li><a href="ref_f-g.html#fontsize_method">fontsize</a>, <a href="ref_s-s.html#small_method">small</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="blink_method"><h2>blink method</h2></a>
<p>
Causes a string to blink as if it were in a <BLINK;> tag.
<h3>Syntax</h3>
<pre><i>stringName</i>.blink()</pre>
<p><i>stringName</i> is any string or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_s-s.html#string_object">string</a>
<h3>Description</h3>
<p>Use the blink method with the write or writeln methods to format and display a string in a document.
<h3>Examples</h3>
The following example uses string methods to change the formatting of a string:
<pre>
var worldString="Hello, world"
document.write(worldString.blink())
document.write("<P;>" + worldString.bold())
document.write("<P;>" + worldString.italics())
document.write("<P;>" + worldString.strike())
</pre>
<p>The previous example produces the same output as the following HTML:
<xmp>
<blink>Hello, world</blink>
<p><b>Hello, world</b>
<p><i>Hello, world</i>
<p><strike>Hello, world</strike>
</xmp>
<h3>See also</h3>
<li><a href="ref_a-c.html#bold_method">bold</a>, <a href="ref_h-l.html#italics_method">italics</a>, <a href="ref_s-s.html#strike_method">strike</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="blur_method"><h2>blur method</h2></a>
<p>
Removes focus from the specified object.
<h3>Syntax</h3>
<pre>
1. <i>passwordName</i>.blur()
2. <i>selectName</i>.blur()
3. <i>textName</i>.blur()
4. <i>textareaName</i>.blur()
</pre>
<p><i>passwordName</i> is either the value of the NAME attribute of a password object or an element in the <i>elements</i> array.
<br><i>selectName</i> is either the value of the NAME attribute of a select object or an element in the <i>elements</i> array.
<br><i>textName</i> is either the value of the NAME attribute of a text object or an element in the <i>elements</i> array.
<br><i>textareaName</i> is either the value of the NAME attribute of a textarea object or an element in the <i>elements</i> array.
<h3>Method of</h3>
<p><a href="ref_m-q.html#password_object">password</a>, <a href="ref_s-s.html#select_object">select</a>, <a href="ref_t-z.html#text_object">text</a>, <a href="ref_t-z.html#textarea_object">textarea</a>
<h3>Description</h3>
<p>Use the blur method to remove focus from a specific form element.
<h3>Examples</h3>
<p>The following example removes focus from the password element <i>userPass</i>:
<pre>
userPass.blur()
</pre>
This example assumes that the password is defined as:
<pre><INPUT; TYPE="password" NAME="userPass"></pre>
<h3>See also</h3>
<li><a href="ref_f-g.html#focus_method">focus</a>, <a href="ref_s-s.html#select_method">select</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="bold_method"><h2>bold method</h2></a>
<p>
Causes a string to be displayed as bold as if it were in a <B;> tag.
<h3>Syntax</h3>
<pre><i>stringName</i>.bold()</pre>
<p><i>stringName</i> is any string or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_s-s.html#string_object">string</a>
<h3>Description</h3>
<p>Use the bold method with the write or writeln methods to format and display a string in a document.
<h3>Examples</h3>
The following example uses string methods to change the formatting of a string:
<pre>
var worldString="Hello, world"
document.write(worldString.blink())
document.write("<P;>" + worldString.bold())
document.write("<P;>" + worldString.italics())
document.write("<P;>" + worldString.strike())
</pre>
<p>The previous example produces the same output as the following HTML:
<pre>
<tt><BLINK;>Hello;, world</BLINK></tt>
<tt><P;><B;>Hello;, world</B></tt>
<tt><P;><I;>Hello;, world</I></tt>
<tt><P;><STRIKE;>Hello;, world</STRIKE></tt>
</pre>
<h3>See also</h3>
<li><a href="ref_a-c.html#blink_method">blink</a>, <a href="ref_h-l.html#italics_method">italics</a>, <a href="ref_s-s.html#strike_method">strike</a> methods
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="button_object"><h2>button object</h2></a>
<p>A pushbutton on an HTML form.
<h3>Syntax</h3>
<p>To define a button:
<pre>
<INPUT;
TYPE="button"
NAME="<i>buttonName</i>"
VALUE="<i>buttonText</i>"
[onClick="<i>handlerText</i>"]>
</pre>
<i>NAME="buttonName"</i> specifies the name of the button object. You can access this value using the name property.
<br><i>VALUE="buttonText"</i> specifies the label to display on the button face. You can access this value using the value property.
<p>To use a button object's properties and methods:
<pre>
1. <i>buttonName</i>.<i>propertyName</i>
2. <i>buttonName</i>.<i>methodName</i>(<i>parameters</i>)
3. <i>formName</i>.elements[<i>index</i>].<i>propertyName</i>
4. <i>formName</i>.elements[<i>index</i>].<i>methodName</i>(<i>parameters</i>)
</pre>
<i>buttonName</i> is the value of the NAME attribute of a button object.
<br><i>formName</i> is either the value of the NAME attribute of a form object or an element in the <i>forms</i> array.
<br><i>index</i> is an integer representing a button object on a form.
<br><i>propertyName</i> is one of the properties listed below.
<br><i>methodName</i> is one of the methods listed below.
<h3>Property of</h3>
<li><a href="ref_f-g.html#form_object">form</a>
<h3>Description</h3>
<p>A button object on a form looks as follows:
<form>
<p><input type="button" value="Click me">
</form>
<p>A button object is a form element and must be defined within a <FORM;> tag.
<p>The button object is a custom button that you can use to perform an action you define. The button executes the script specified by its onClick event handler.
<h3>Properties</h3>
<li><a href="ref_m-q.html#name_property">name</a> reflects the NAME attribute
<li><a href="ref_t-z.html#value_property">value</a> reflects the VALUE attribute
<h3>Methods</h3>
<li><a href="ref_a-c.html#click_method">click</a>
<h3>Event handlers</h3>
<li><a href="ref_m-q.html#onClick_event">onClick</a>
<h3>Examples</h3>
<p>The following example creates a button named <i>calcButton</i>. The text "Calculate" is displayed on the face of the button. When the button is clicked, the function <i>calcFunction()</i> is called.
<xmp>
<input type="button" value="Calculate" name="calcButton" onclick="calcFunction(this.form)">
</xmp>
<h3>See also</h3>
<li><a href="ref_f-g.html#form_object">form</a>, <a href="ref_r-r.html#reset_object">reset</a>, and <a href="ref_s-s.html#submit_object">submit</a> objects
<!------------------------------------------------------------------------------------------------->
<hr>
<a name="ceil_method"><h2>ceil method</h2></a>
<p>
Returns the least integer greater than or equal to a number.
<h3>Syntax</h3>
<pre>Math.ceil(<i>number</i>)</pre>
<p><i>number</i> is any numeric expression or a property of an existing object.
<h3>Method of</h3>
<p><a href="ref_m-q.html#Math_object">Math</a>
<h3>Examples</h3>
<pre>
//Displays the value 46
document.write("The ceil of 45.95 is " + Math.ceil(45.95))
//Displays the value -45
document.write("<P;>The; ceil of -45.95 is " + Math.ceil(-45.95))
</pre>
<h3>See also</h3>
<li><a href="ref_f-g.html#floor_method">floor</a> method
<!------------------------------------------------------------------------------------------------>
<hr>
<a name="charAt_method"><h2>charAt method</h2></a>
<p>
Returns the character at the specified <i>index</i>.
<h3>Syntax</h3>
<pre><i>stringName</i>.charAt(<i>index</i>)</pre>
<p><i>stringName</i> is any string or a property of an existing object.