Вы находитесь на странице: 1из 314

..

JavaScript"

SAMS

SAMS

JavaScript
24

Michael Moncur

SAMS

Teach Yourself

JavaScript
Hours

in 24

2nd Edition

SAMS
A Division ofMacmillan Computer Publishing
201 West 103rd St., Indianapolis, Indiana, 46290 USA

^^Jgi>
S^AIS

**

JavaScript

""
-
2007

32.973.26-018.275.

77

681.3.07
""
. .
""
: info@williamspublishing.com, http://www.williamspublishing.com

77

, .
JavaScript 24 , 2- . : .
. : . : "", 2001. 320 . : . .
. .
ISBN 5-8459-0159-6 (.)
24 , . JavaScript 1.5
, .
, JavaScript .
, , .

JavaScript. ,

. .
32.973.26-018.275

.
,
, , Sams Publishing.
Authorized translation from the English language edition published by Sams Publishing,
Copyright 2000
All rights reserved. No part of this book may be reproduced or transmitted in any form or by any
means, electronic or mechanical, including photocopying, recording or by any information storage
retrieval system, without permission from the Publisher.
Russian language edition published by Williams Publishing House according to the Agreement
with R&I Enterprises International, Copyright 2001

ISBN 5-8459-0159-6 (.)


ISBN 0-672-32025-8 (.)

"", 2001
Sams Publishing, 2000

I.
1 - . JavaScript
2- .
3- . JavaScript
4- . JavaScript

II. JavaScript

20

21
22
31
42
53

59

5- .
6- .
7- .

60
74
86

8- . - :

95

III. JavaScript

105

9- .
10- .
11- .

106
116
127

12- .

135

IV. Web-

127

13- .
14- .
15- .
16- .

146
158
172
185

V. JavaScript

195

17- .
18- .
19- .
20- .


DOM
DOM

VI. JavaScript

196
208
217
228

239

21- . JavaScript
22- . Web-
23- .
24- . Web
. JavaScipt

240
253
265
281
288

. JavaScript

290

293

. JavaScript

295

304

I.

20

21

1 - .

JavaScript
JavaScript

JavaScript
JavaScript Web-
, JavaScript
Netscape Internet Explorer
JavaScript
JavaScript
Java
ActiveX
VBScript
CGI

22
23
23
24
26
26
26
27
27
28
28
28
29
29
29
30
30

2- .





JavaScript



Web-



31
32
33
33
33
34
34
34
35
36
37
38
39
40
40
41
41
41
41

3- .
JavaScript









42
43
43
43
44
45
45
47
48
49
49
51
51
52
52
52
52

4- .
JavaScript

II. HaJavaScript
5- .









JavaScript

53
54
54
54
55
56
56
56
57
57
58
58
58
58

59
60
61
61
62
63
64
65
65
67
68
69
69
71
71

72

6- .


String
String














74

77
78
78
78
79
79
80
80
80
80
81
81
83
84
84
84
84
85

7- .


if


else


86
87
87
88
89
89
90
91
93
93
93
93
94
94

8- .

:

while
do...while

95
96
97
98
98




for...in

III. JavaScript

98
99
99
100
100
102
103
103
103
103
104
105

9- .

with
Math



Date
Date
Date


Math

106
107
107
107
107
108
108
108
109
109
110

110
111
111
111
114
114
114
114
115
115

10- .



DOM
window
Web-


Web-


location

Back Forward

116
117
118
118
118
119
120
120
121
122
122
123
124

125
125
125
125
126

11- .

127
128
128
129
129
130
131
133
133
133
133
134
134

12- .


JavaScript


JavaScript
event
,


,
onLoad

IV. Web-

135
136
136
136
137
137
138
138
138
140
140
141
143
143
144
144
144
144
145

13- .

146
147
147
148
148
150
151
152
J53
153

frames

1 4- .



form
form





154
154
156
156
157
157
157
157
1 58
159
159
159
1 60
160
160
160
161
161
162
162
163
163
164
1 65
166
168
1 70
170
171
171
171
171

15- .




images




HTML


172
173
175
175
176
176
178
178
179
179
180
181
1 83

184

16- .




JavaScript



, JavaScript

V. JavaScript
17- .


CSS







JavaScript

18- .
DOM
DOM

12

184
185
186
186
187
189
190
190
191
191
192
193
193
194
194
194
194

195
196
197
197
198
198
199
199
200
200
202
202
203
206
206
206
206
207
207
208
209
21
210
210
210
211
212
212
213
215
215

215
215
216
216

19- .
DOM
DOM







217
218
218
218
219
219
219
221
222
223
226
226
227
227
227

20- .

LiveConnect
MIME
LiveConnect








VI. JavaScript
21 - .
JavaScript




JavaScript

228
229
229
230
230
230
231
232
233
233
233
234
235
235
235
236
237
237

239
240
241
241
241
243
243
243

13


Internet Explorer

JavaScript








244
244
244
245
245
245
246
247
247
247
248
248
249
251
251
251
251
252
252

22- .

Web-
HTML


HTML





253
254
255
255
256
257
257
259
259
259
260
262
262
263
263
264
264

23- .





HTML

Draw Deal





265
266
266
266
267
269
269
269
270
270
271
271
274

24- .
Web
JavaScript
Web
JavaScript
DOM
XML
XSL


HTML

. JavaScipt

Web-, JavaScript
Web
. JavaScript
HTML
HomeSite
FrontPage
NetObject ScriptBuilder
BBEdit

HTML
.

281
282
282
282
282
283
283
284
284
284
285
285
286
286
286
286
287
287
288
288
288
289
290
290
290
291
291
291
291
291
293

. JavaScript

Array
String
Math
Date
DOM
Window
Location
History
Document
Navigator

295
295
295
296
297
298
298
299
299
299
300
300

279
279
279
279
279
280

15




JavaScript

for
for...in

if..else
return
var
while
JavaScript
eval
parselnt
parseFloat

300
300
301
301
301
301
301
301
302
302
302
302
302
303
303
303
303
303
304


(Michael Moncur)
Web- . Internet
Gopher.
, Laura Lemay's Web Workshop: JavaScript
Sams JavaScript Unleashed
Sams Teach Yourself CGI Programming with Perl 5
in a Week. ,

Microsoft Netscape.
( )

.


(Laura).

.


Sams
.
(Scott Meyers) (Mark Taber),

. (Susan
Hobbs) ,

(Sunil Hazari) .
,
.
(David Mayhew),
(Sean Medlock) (Michelle Wyner).

(David and Sherry Rogelberg)
.

(Gary and Susan Moncur),
( (Matt), (Melanie), (Ian)
(Kristen)) ( (Chuck Perkins),
(Matt Strebe), (Cory Storm),
(Robert Parsons), (Dylan Winslow),
(Scott Durbin), (Ray Jones),
(James Chellis), (Curt Sifferi) .
(Henre J. Tillman)).

.


World Wide Web ; ,
, , .
. , HTML, . JavaScript.
, "".
, ,
. (, , ,
"".)
JavaScript ,
. , JavaScript . JavaScript, .
"2- . ".
HTML , Web, JavaScript. JavaScript
.
, ,
.
Web- , Web
. , ? JavaScript,
Web. , .
. ,
. ,
.


24 .
JavaScript . JavaScript. .
, .
( 24 , .
, .)

,

. " " .
"" , , "" .

I


1. JavaScript
2.
3. JavaScript
4. JavaScript

1-
JavaScript
World Wide Web (WWW)
. HTML
. ,
Web ( , , ), .
Web- :
, , , . Web, JavaScript,
Web- Web .

Web- JavaScript.
JavaScript, Java Web
. .
Web

JavaScript
JavaScript Web-
JavaScript
JavaScript

22

I.

JavaScript
( ) . , . BASIC, Java.
Web- HTML, , , , . HTML , , Web- .
HTML ,
, Web- . . .
, . ,
. Web
, Web-.


( ) (), . JavaScript , .
( JavaScript
, JavaScript.)
? . ,
( ) JavaScript.

, , , . JavaScript, , .
, .
:
.
JavaScript , HTML.
Web .

.
- .
( JavaScript
).

JavaScript
JavaScript Netscape Communication Corporation, Web- Netscape Navigator. JavaScript
, ,
.
1- . JavaScript

23

JavaScript LiveScript
Netscape Navigator 2.0 1995 . JavaScript,
Java.

JavaScript , HTML. JavaScript


HTML. JavaScript
.
.
.
(,
.)
, ( , ).
,
.
, , .
Web-.

.
, JavaScript.
, ,
. .

JavaScript
Web-
, HTML ,
Web-. , HTML ( 1.1).

1.1. HTML
1:
2:

<>
<HEAD>

3:

<1> </1>

4:

</HEAD>

5:
6:
7:
8:
9:
10:
11:

<BODY>
<1> </1>
<>
Web-.
</>
</BODY>
</HTML>

, <HEAD>, ,
<BODY>. JavaScript
Web-, <SCRIPT>.
24

I.

<SCRIPT>
. </SCRIPT>, HTML. JavaScript ( <SCRIPT> </SCRIPT>).
, .
<SCRIPT>, Web-
( , 1.2, ). 1.2,
.

1.2. HTML
1:
2:

<HTML>
<HEAD>

3:

<1> </1>

4:
5:

6:
7:
8:
9:
10:
11:
12:
13:
14:

</HEAD>
<BODY>

<1> </1>
<>
Web-.
</>
<SCRIPT LANGUAGE="JavaScript">
document.write(document.lastModifled);
</SCRIPT>
</BODY>
</HTML>

document.write, ,
Web-. .
, <SCRIPT> 1.2
Language="JavaScript".
. ( ).
Web-.

HTML.
. Web .
<HEAD>. , , , . JavaScript, .
HTML. JavaScript .
, <SCRIPT> .
"4- . JavaScript".
. JavaScript js, .
, <SCRIPT>.
JavaScript Netscape Navigator 3.0
Internet Explorer 4.0 .
1- . JavaScript

25

, / JavaScript
HTML, JavaScript . -. HTML, JavaScript . (
HTML),
.
,
JavaScript.

Netscape Internet Explorer



Netscape Navigator Internet Explorer. Netscape Navigator
Web-. Internet
Explorer ,
. JavaScript.
JavaScript 1.5, ,
Netscape Navigator 4.5 ,
, , Internet
Explorer, Netscape Navigator 4.0 .

JavaScript
JavaScript
Netscape Navigator 2.0. JavaScript.
JavaScript 1.0. , Internet Explorer 3.0
Netscape Navigator 2.0.
JavaScript 1.1. Netscape Navigator 3.0 Internet Explorer 4.0
( ).
JavaScript 1.2. Netscape Navigator 4.0 Internet Explorer 4.0
().
JavaScript 1.3. Netscape Navigator 4.5.
JavaScript 1.5. Netscape 6.0. Internet Explorer 5.5 .
JavaScript, . ,
JavaScript, , JavaScript.
JavaScript , . -262,
. ECMAScript. JavaScript 1.3 -262, a JavaScript 1.5 -262 .
, , JScript.
Microsoft Netscape JavaScript.
JavaScript.

26

I.

JavaScript
JavaScript Web. ,
. Java, , ,
JavaScript. Web,
JavaScript.

Java
Java Sun Microsystems , , Web-.
Java . , .
Web-. , Java :
Windows, Mac Unix .
Java , ,
.

. Java , . JavaScript Java,


.

ActiveX
ActiveX , Microsoft,
Web- Windows. ActiveX , Visual C++ Visual Basic.
, .
ActiveX, ,
Web- , Java. Java,
. .
ActiveX .
: - Web-, , , .
, ActiveX . "" , .
, ActiveX . . Internet
Explorer, Windows.

1- . JavaScript

27

VBScript
VBScript, , Visual
Basic, JavaScript Microsoft. JavaScript Java,
VBScript Visual Basic,
Windows.
JavaScript, VBScript ;
VBScript HTML, JavaScript.
VBScript <SCRIPT LANGUAGE="VBScript">.
VBScript , JavaScript.
. .
, Visual Basic, VBScript.
ActiveX, Microsoft Web .
VBScript
Internet Explorer. , JavaScript Netscape Navigator,
Internet Explorer. , JavaScript ,
, Web-.

CGI
CGI (Common Gateway Interface ) , , Web-.
CGI : Perl, , Visual Basic ..
CGI Web. Web- CG1.
JavaScript CGI , CGI
Web-, JavaScript ( Web-). CGI
, ( ).
, , CGI
. , CG1 . JavaScript
. . Web- JavaScript, .
CGI- Web
, Active Server Pages (
), JavaScript Pages ( JavaScript), Cold Fusion Markup Language
( ) PHP. He
JavaScript, .
CGI . CGI
.

Web ,
, JavaScript. ,
Web-, JavaScript Web.

28

I.


Java CGI,
JavaScript?
. JavaScript , . , Java CGI , JavaScript.
Web- , <SCRIPT>?
. , , ,
.
, Internet
Explorer, Netscape Navigator?
, . JavaScript
. ,
. , - . JavaScript , , .
Netscape?
<SCRIPT>, , Netscape Navigator 2.0. .
, JavaScript ?
HTML,
JavaScript HTML. 2.


1. JavaScript Java ?
a) JavaScript Java
b) JavaScript Java
c) Java
2. JavaScript
, ?
a) , Web
b) Web-
c) , Netscape
3. Netscape Navigator, Internet
Explorer?
a) VBScript
b) ActiveX
c) JavaScript

1- . JavaScript

29


1, b) , .
2, ) JavaScript Web- (, , JavaScript, , ).
3, ) JavaScript Internet Explorer, Netscape Navigator, -.

JavaScript,
. Web- Netscape, , http://developer.netscape.com/

I.

2-

" JavaScript",
JavaScript Web-. JavaScript
HTML,
.
, Web-. ,
. .


JavaScript

Web-
Netscape


2- .

31



JavaScript. .
, , . ,
, HTML.
.
, , ;
Windows Notepad.
JavaScript , ASCII, .

HTML,
JavaScript. JavaScript (,
).
Windows .
HomeSite. HTML,
JavaScript.
Microsoft FrontPage 2000. HTML Microsoft.
Script Builder, , .
TextPad. , , , Notepad.
Macintosh, BBEdit, BBEdit Lite Alpha
HTML, Web- .
Web-, HTML .

JavaScript Web . JavaScript 1.5, Netscape Navigator. , , , Netscape


Navigator Windows, Macintosh Unix.
Web- Netscape, :

http://www.netscape.com/
Microsoft http://www.microsoft.com/.
Netscape 4.5 Internet Explorer
4.0 . ( DOM), 17, Netscape Navigator 6.0 Internet Explorer 5.0 .
Internet, Web . , ,
.

32

I.


JavaScript .
JavaScript ,
. .

. . .

JavaScript
Web-.


, JavaScript, <SCRIPT>. 1, <SCRIPT></SCRIPT>
HTML .
. HTML, ,
.

<SCRIPT>, 2.1 ( , , .)

2.1. JavaScript
1:
2:

<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>

JavaScript, 1.0, JavaScript 1.1. Netscape Navigator 2.0 ,


Internet Explorer 2.0 .

JavaScript
,
, . JavaScript.

2- .

33


, .
"5- . ".
, (
, , ).
<SCRIPT> . JavaScript , -:
now = new Date();
now, . , ,
Data, . JavaScript
"9- . ".
JavaScript . . , , , .


JavaScript

1 1970 . , JavaScript ; , , , .
, </SCRIPT>
.
localtime=now.toString();
utctime=now.toGMTString();
: localtime utctime. , .
. , January 1,2001 12:00 . ,
. "6-
. ".


, , , . . JavaScript
. document.write.
document.write , .
Web-,
:
document.write("<> : </b>" + localtime + "<BR>");
document.write("<b> : </b>" + utctime + "</p>");
34

I.

,
.
"+", . . "+" ,
, , .

Web-
, Web-. .
2.2. , 2.3, 2.2.

2.2.
1:
2:
3:
4:
5:
6:
7:

<SCRIPT LANGUAGE="JavaScript">
now = new Date();
localtime=now.toString();
utctirae=now.toGMTString();
document.write("<> : </b>" + localtime + "<BR>");
document.write("<> : </b>" + utctime + "</p>");
</SCRIPT>

2..
1:
2:


now

4:
5:
6:
7:

utctime
localtime Web-
utctime Web-

3:

localtime

, HTML. HTML <HTML>, <HEAD>


<BODY>.
Web-
,
HTML ( 2.4).

2.4. HTML

1:
2:
3:
4:
5:
6:
7:
8:

<HTML>
<><1> </></>
<BODY>
<1> </1>
<>
<SCRIPT LANGUAGE="JavaScript">
now = new Date();
localtime=now.toString();

2- .

35

utctime=now.toGMTString();
document.write("<> : </b>" + localtime + "<BR>");
document.write("<> : </b>" + utctime + "</p>");
</SCRIPT>
</BODY>
</HTML>

9:
10:

11:
12:

13:
14:

HTML JavaScript. .html .htm. ( Windows 3.1 .htm.)


, Notepad,
.txt.
.


, Web- . Netscape Navigator, File () Open Page ( ).
Choose File () . , Open ().
HTML , Web-,
. 2.1. (
, , , .)
&- - N elicape
ie

View

ommunicafei
.....
Retoad

at. &

:each Guide

Bookmark* ^ Location: JMe : /Dl/IJ iek t


t-Jrt Mettage

j4' intwiel

Secu*y
ctipt SE/LlsI/2l_4 Nml

_j Loohup


: Tut Feb 13 14:31:03 , () 2001
: . 13 Feb 2001 12:31:03 QMT

. 2.1.

I.


Web-, , , , .
,
. , . JavaScript HTML.
: , .
JavaScript. 2.5 .

2.5. HTML

1:
2:
3:
4:

<HTML>
<><1> </1/>
<BODY>
<1> </1>

5:

<>

6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20;

<SCRIPT LANGUAGE="JavaScript">
now = new Date();
localtime=now.toString();
utctime=now.toGMTString();
hours=now.getHours();
mins=now.getMinutes();
secs=now.getSeconds();
document.write("<> : </b>" + localtime + "<BR>");
document.write("<> : </b>" + utctime + "</p>");
document.write("<font s i z e = ' + 5 ' > " ) ;
document, write (hours + " : " + mins + ":" + sees);
document.write("</font>");
</SCRIPT>
</BODY>
</HTML>

10-12. ,
.
15 <font>. .
, (:). 17 JavaScript </font>.
Web- HTML. .
Reload, . , , 2.5. . 2.2 .

2- .

tV - Escape
*' l& 'View go onunicet He* /'
:

' -f

Back

'*- ' 3

.,..;: Reload

Home

'asT 4.'
Sea/ch

Giade

Prim

si'

Security

'' 4,1 * Boofcrowbi & 18|57/01 3/j^sScN P i_j. '; ist/2_5 her.
'' '-' Mesege ^ Internet ^j Lookup lj NevuCod


Tue Ftb 13 15:02:29 . () 2001
* . Tut, Ftb 2001 1302:29 GMT

15:2:29

. 2.2.


JavaScript . , .
: ? : . ,
Netscape Navigator JavaScript.
. ,
, .
:

document.write("</font>";
HTML . ,
.
.
, ,
. -, .
Netscape Navigator 4.5 JavaScript Console,
. JavaScript, javascript:.
. 2.3. ,
.

38

I.

Internet Explorer 4.0 Tools^lnternet Options


( ). Advanced ()
Disable Script Debugging ( )
Display a notification about every script error (
).
JK - NMreapo
JavaScript Error: file;/?i/EOOKS/TY_JS 1.?
'j. E / s i pt s /' list 2 - v:. ht :i>. 1, 1 ine 17 :
ittisaiftg ) after argument list.
document.. write ( "</ f ont>" ;

javascript fypein

| Close j

Puc. 2,J. JavaScript Console


missing ) after argument list, . ,


. , JavaScript ,
.
JavaScript.
JavaScript, . JavaScript.

, Internet Explorer , Netscape Navigator 4.5


. JavaScript Netscape Navigator.


JavaScript <SCRIPT>, ,
Web-. ( ).
, . .
"", , , , .
HTML <! -->. 2.6 , .
2- .

39

2.6.
1:

<SCRIPT LANGUAGE="JavaScript">

2:

<!--

3:

document.write(" JavaScript");

4:

// -->

5:

</SCRIPT>

HTML. // . HTML
JavaScript.
JavaScript .
( >) ,
.

JavaScript . JavaScript
. , Web- .

JavaScript , document.write . .


JavaScript 1.5, <SCRIPT>
?
,
JavaScript 1.5, . HTML <SCRIPT LANGUGE="JavaScript 1.5">,
Netscape Navigator 6.0 .
JavaScript , Netscape Navigator 3.0
, Internet Explorer , JavaScript.
, . ?
. : <SCRIPT>. ,
<SCRIPT LANGUAGE="JavaScript">. : .txt. HTML (.htm
.html). : JavaScript
.
<> <> . , HTML .
, . HTML , .

40

I.

Web- . , Web-?
. . js
( <SCRIPT>). <SCRIPT> : <SCRIPT LANGUAGE="JavaScript" 5="_.js">.
JavaScript 1,1 .


1. JavaScript?
a)
b)
c)
2. JavaScript?
a) ,
b)
c)
3. JavaScript?
a) <SCRIPT LANGUAGE="JavaScript">
b) </SCRIPT>
c) END

1, ) JavaScript
. HTML.
2, ) , .
3, ) </SCRIPT>.

, , .
. ,
.
.
getMilliseconds. .
.
, getUTCHours,
getUTCMinutes getUTCSeconds. JavaScript
1.2 .

2- .

41

3-
JavaScript
"2- . " JavaScript. ,
Web-, . Web-. JavaScript.
JavaScript,
. JavaScript . ( .)
.
JavaScript

JavaScript
JavaScript
JavaScript
JavaScript
JavaScript
Web-

42

I.



- Web- ( , Internet)? JavaScript Web-. , , ,
.


,
. .

URL
JavaScript . , ,
, Web. ( ),
.
, ,
, "6- . ". , .

,
. JavaScript
: , , Web-.


JavaScript HTML
. , , Web- , Web-.
. .
.
JavaScript.
Web- "14- . ". JavaScript . , Web Netcenter Netscape, . 3.1,
, .

. Search (), .

3- . JavaScript

43

gj WttMal $ Peopte gl Veto*. Pages gi Download New 4 Cool Cj Dam*. ReaRajre

LATEST NEWS Wi
Monday, June f, 2000
Up'Jai*4 *ry 15 minutes

-Dosens billed as
powerful earthquakes
shake Indonesia
- Solomon Islands
premier taken
by. aimed, rebels
- Business Seaa.
Moloifla lo Develop
Internet Cell Phone
- Sports Lakers Rally
Past Tiail Blazets And
into Finals

gg Netscape
Netcenter

Business

Free Time

MARKET CENTER

Ask a Question
Aboul.com
Excite
Google
GoTo.com
HotBot
LookSmart
Lycos
Snap.com

Slionniiii! Shortcuts

..timSiLSFeatures...

It may be hot outside, but it is always


e Net. Surf your way to Tito Puente's
esidential politics, and gifts for golfers and
geeks. MoreWliafs Cool'
What's New' I Mondo-Mioi Show: Cheach and
Chong i Pi?v Qarnes Online

Mote Ne

io-a
1
rv'nmfcetam ;
Channels
ind trttr t.

of Fuentes
nce Finjli Atfi
(
online witfc
t,, 4Q
SlM up
,3::Whn!<, Jd

Aitdifi > Netscape Radio. Mul

nt Sales * NewCars.

In our CjTtt

ftc. J./. Netcenter Netscape


JavaScript ,
. , ,
.
. 3.2. , , , .
, ,
JavaScript .
, ..
. 3.2. , JavaScript
Web-
HTML.
, Web-. JavaScript , .
"10- . "
, "13- .
"
.

I.

Netscape Navigator Internet Explorer HTML, JavaScript. Web ( ).


( Windows) . JavaScript
.
Web- "18- .
DOM".


, Web- , . , , , , JavaScript.
HTML
. Web- , HTML. JavaScript . JavaScript 1.1 , Web- , .

. , , , Web-.
, ,
, , ,
. "15- . ".

JavaScript ,
. (,
), Web- .
JavaScript. Java . Java ( , ). GIF .
, ShockWave QuickTime.


Web
. ,
Web-. , Web-. : .
3- . JavaScript

45

CGI ( ). .
Submit ().
. Web- .
CGI , ,
Web-. CGI
Perl, ,
JavaScript, Visual Basic.

, CGI , .

.
, .
, CGI . , , .
,
Web-, .
.
, JavaScript . JavaScript , , . , .
JavaScript,
, "14- . ".

JavaScript ,
, , . JavaScript
CGI.
JavaScript . . 3.3 , JavaScript.
JavaScript , CGI,
. , CGI?
, , ,
, CGI. (
JavaScript, . CGI.)

46

I.

& Older Fonn -Netscape

Fte * Bw 2 Window ,

Bk

Reload

Hcfirt*

Seaich

Netscape

Pfint,

, 2] Inslart Message [gl WtbMail :jgj Peopte' igl.ValowPag.? '3

Order Form
Name: j
'Phone: I
Billing and Sliippiiig Addresses:
Enter vour billing address here.

dJ
to Order:
Qry: )i
Qty: J2
Qry: P
Ql'/: I3

E-mail address:)

Enter your shipping address here.

'

! Cost- p o ( $ 4 0 00 ea) Fictional Spreadsheet 7.0


! Cost: |9.90; ($9,95 ea) Fictional Word Processor 6.0
I Cost: J99-9S "l ($99.95 ea) Fictional Database 7.0
I Cost: jn.es

($4.95 ea) Instruction Booklet for the above

Method of Payment | Check or Money Order


Credit Card or Check Number: j
Send Your Order

Slart |

T.I

. .. , JavaScript


HTML , .
, HTML, , .
Web-, ,
. Netscape
Microsoft HTML. , , ,
. ,
, - Web-.
Web- , , , . ,
Web-.
.
Web-
. JavaScript . Web-. ,
, , .

3- . JavaScript

47

Web-
Internet Explorer, Netscape Navigator. JavaScript ,
( ).

Microsoft Netscape ( ) JavaScript. JavaScript


JavaScript, . "16- .
".
, Web-, Web-. ,
HTML . ,
.


, HTML . , .
.
RealAudio. .
QuickTime. .
Adobe Acrobat. .
ShockWave. .
, HTML
. :
, , .
,
. ,
Web-, (
).
, JavaScript .
Web- . , Web-,
. , .
, JavaScript . JavaScript LiveConnect.
, LiveConnect JavaScript Java JavaScript.

, Web-
JavaScript . , , .

48

I.

, JavaScript , "20- . ".


JavaScript. , .
JavaScript
. ,
, .
"23- . " .
.


, JavaScript.

.
, Web-.

HTML, .
fcnnee etpoui - Netscape
Fte c&t

Back

View e

-'; - ' "

.JTSoofcmeki
& Instant Mwsase

ownurtcat

Reload

rft j*.

Home

Search

Guide

-*

Print

Security

11

Stop

IS

Jk Lc<tion:[r^7//DWa^SciiptExci;yu^/3_l'binl
'$$ Internet -J$ Lookup j N


( - ).

;." , ?..

. 3.4. Web-

3- . JavaScript

49

, Web-
,
.
. Web-
. HTML,
, .
. . " JavaScipt".
, Web, :

http://www.jsworkshop.com/scroll.html
. (
Web-, .)
. 3.4 Web- Netscape Navigator.
,
Page Source ( HTML) View ().
HTML . 3.1 .

3.1. HTML
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

<HTML>
<><1> </1>
<SCRIPT LANGUAGE="JavaScript">
var msg = " . , ?";
var spacer = "...
...";
var pos = 0;
function ScrollMessage(){window.status =
msg.substringfpos, msg.length) + spacer +
msg.substring(0,pos);
pos++;
if (pos > msg.length) pos = 0;
window.setTimeout("ScrollMessage()",200);
}
ScrollMessage();
</SCRIPT>
</HEAD>
<BODY>
<1> </1>

( -
).
</BODYX/HTML>

, 6. , Web.
<SCRIPT> </SCRIPT> .
Windows
<Ctrl+C> (Windows). Paste () Edit ()
Web-.
50

I.

,
<HEAD>. , </SCRIPT> </HEAD>.
, .

var msg=. <SCRIPT>.
HTML Web- . . (
, . 6.)

JavaScript
. JavaScript , ,
.
, ,
. "4- . JavaScript", .


, Web-,
.
Web-. JavaScript HTML?
Java, . JavaScript Web- ,
HTML.
, JavaScript ,
. , ?
, JavaScript .
15.
JavaScript . , JavaScript?
, , , JavaScript, . , , JavaScript, . , JavaScript, <NOSCRIPT>. 1 .
Web-, .
?
, . ,
, JavaScript
.
3- . JavaScript



1. JavaScript, ?
a)
b)
c)
2. CGI?
a) Web-
b) , Web-
c) , Web-

1, ) JavaScript
2, b) CGI ( ),
Web-

JavaScript , .
Web , JavaScript
Netscape aboutrplugins.
,
.

I.

4-
JavaScript
I. JavaScript,
Web-.
JavaScript,
. , .
.

JavaScript
JavaScript
, JavaScript,

4- . JavaScript

53


, "2- . ",
. Web-
<SCRIPT> .
</SCRIPT> ( ),
.
JavaScript ,
.
, JavaScript .


JavaScript,
. :

document.write("")
.
, . JavaScript . . ,
, .
( ),
, . ,
. ,
:

text=prompt(" ");
. . : , . : .
, "5- . ".

2 , , ,
. , JavaScript . , .
, .
, , . , .
, , .
. ,
Bob Bob.address Bob.phone.

54

I.

. , . ,
d i s p l a y ( ) , .
JavaScript Bob.display() Bob.
document.write, ,
document. "10- .
".

, , . .
. JavaScript
.
. JavaScript.
"2- . "
: Date Math ( ) . "6- .
" Array String.
.
HTML. , alert(), ,
window.
"10- . ".
. . ,
, .
"11- .
".


1, HTML
<SCRIPT>. .
, . , .
- . ,
: " " " ".
,
.
, , ,
, .
:
.
JavaScript . . JavaScript , . , . JavaScript.
JavaScript ( ) . , , .
,

4- . JavaScript

55

onMouseOver,
. :
<IMG SRC="button.gif" onMouseOver="highlight();">
HTML JavaScript, , .
,
.
"12- . ".


,
,
, .
JavaScript . if:

if (a==l) alert(" 1.");


. 1, , . .
.

JavaScript
, , . . ,
:

for (i=l; i<=10; i++) {


alert("! !");
}
for . JavaScript . ,
.
"8- . : "


1 , Web-
JavaScript, <SCRIPT>. , ? Web- JavaScript, .

56

I.

<SCRIPT>, <HEAD> HTML,


.
, .
, HTML,
, .
HTML .
.
, onLoad Web-.
, ,
HTML.


2 , .
HTML .
.
, , ,
( ,
). JavaScript,
:

//
,
:

= + 1; //
JavaScript - , /* */ , , :

/*
, */
JavaScript, . HTML.

JavaScript.
, , ,
. HTML Web- .
I . JavaScript .

4- . JavaScript

57


, Java - . JavaScript , ?
, . JavaScript , Java .
. ?
(a JavaScript )
,
. .
, , , .


1. , ?
a)
b)
c)
2. JavaScript?
a)
b)
c)
3. ?
a) HTML
b) HTML
c)

1, )
2, )
3, ) Web-

JavaScript,
, .
, 2,
.
2 , .
58

I.

II

JavaScript

5.
6.
7.
8. :

5


.
, JavaScript.
. .





JavaScript


60

II. JavaScript


. , .
</SCRIPT>, .
, . , JavaScript ,
.
.


JavaScript, . , . 5.1 .

5.1.
1:
2:

function Greet))
{
alert("!");

3:

5.1 , . function.
Greet. ,
. , , , .
{}.
. . , ,
. alert,
. !.
. Greet : . ,
.
, , .
, . ,
who, ,
. 5.2 .

5.2.
1:
2:

function Greet(who) {
alert("!" +who);

3:

, ,
HTML. HTML
. , . 5.3 Greet HTML.
5- .

61

5.3. Greet HTML


1:
2:
3:
4:
5:
6:

<HTML>
<HEAD>
<1></11>
<SCRIPT LANGUAGE="JavaScript">
function Greet(who) {
alert("!" + who);

V:

>

8:
9:
10:
11:
12:
13:

</SCRIPT>
</HEAD>
<BODY>

</BODY>
</HTML>


, HTML.
, 5.3 , ,
. , , .
, .
. . , Greet :
Greet("")
Greet . "" who.
. , , ,
.
5.4 HTML, , . , , .
5.4.
1:
2:
3:
4:
5:
6:

<HTML>
<HEAD>
<1></1>
<SCRIPT LANGUAGE="JavaScript">
function Greet(who) {
alert("!" +who);

T-

8:
9:
10:
62

</SCRIPT>
</HEAD>
<BODY>
II. JavaScript

11:
12:
13:
14:
15:
16:
16:
17:

<1> </1>
<> </>
<SCRIPT LANGUAGE="JavaScript">
Greet("")
Greet("flHK")
</SCRIPT>
</BODY>
</HTML>

<SCRIPT>.
, . . , , .
. 5.1.
, ,
.
.

'
#. . Gmde
*; Print
- Security
rf Stop
41.
Home Search

- - -.! Reb*d
kniatks
Metsage

fa

Location
; iolerret

.....Li-.'.'^i.hliTil
__j Lookup ^_j NewACcol

. 5.1. Greet


,
, , . .
, .
5- .

63

function, .
: , , d.
. :
function A v e r a g e ( a , b , c , d ) {
. ; .
. ,
( 4). :
result = (a+b+c+d) / 4;
result
. ( , .)
, , return. :

return result;
}
5.5 Average.

5.5.
1:
2:
3:
4:
5:
6:

<SCRIPT LANGUAGE="JavaScript">
function Average(,,,d) {
result = (a+b+c+d) / 4;
return result;
}
</SCRIPT>

HTML, . , 3, 4, 5 6
:

score = Average(3, 4, 5, 6);


. , alert :
alert(Average! 1, 2, 3 , 4 ) )


. , , . , .

64

II. JavaScript


(, ,
). , .
.
, ,
, (09) .
.
. ,
totalnum, Totalnum TotalNum JavaScript
.
,
. (
.)
,
:

total number_of_fish
LastlnvoiceNumber
tempi
a
var39
, , , . . , ,
, , , xl,
.



. JavaScript var
. . ,
.
, , . , . .
. (
HTML).
.
. .
, .
, ,
.
var:

var students=25;

5- .

65

students 25.
, ,
. var . :
students=25;
var, , . var .
.
.

.
( ) . , .
var. JavaScript , .
JavaScript
, 5.6.
Greet)), "4- . JavaScript".
5.6. ,

1:
2:
3:
4:
5:
6:
7:
8:
9:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
var !=""
var 2=""
function Greet(who) {
alert("!" +who);
var 2="";

10:

11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<> </>
<SCRIPT LANGUAGE="JavaScript">
Greet(name1)
Greet(name2)
</SCRIPT>
</BODY>
</HTML>

5.6 .
namel name2 , ;
who , Greet().
66

II. JavaScript

, ,
Greet() name2. var, name2. ( , , , .)
, . , .

, HTML.
, ,
. (
), .
, . . var, .


"2- . " . , lines 40:
lines = 40;
,
. :
lines = lines + 1;
, JavaScript ,
. +=:
lines +=1;
:
lines -=1;
, , (++ ). :
lines ++;
:
lines ;
++ -- . ,
++lines. , .
.
,
.
,
.

5- .

67


.
lines 40. :
alert (lines-H-);
alert(++lines);
40, lines
. 41.
.
, (+1 -1) .

JavaScript

. JavaScript .
. JavaScript .
JavaScript .
. , 3, 25 1.4142138. JavaScript .
, . : true () false
(). .

"7- . ".

. , " ".
. ( ,
, "6-
. ".)
. null.
. , document.write ( f i g ) , f i g .
JavaScript , ,
. , :
total = 3 1 ;
total 31. . , :
total = "";
total . . ,
total.

68

II. JavaScript

JavaScript , . , total , , .


JavaScript
. :

document, write (" : " -I- total);


total 40,
: : 40. document.write , ( total)
. .

. , . ,
, total 40:

average = total / 3;
total ,
.
. JavaScript .
parselnt(). .
parseFloatQ. .

. , 30 :

stringvar = "30 "


numvar = parselnt(stringvar);
numvar 30.
.
.
, NaN,
, .

5- .

69




. ,
HTML, .
.
(, , Web,
.) JavaScript prompt. alert.
, . :

first = prompt(" .");

second = prompt)" .");


title = prompt(" .");
.
, :

document.write)"<H1>" + title + "</Hl>");


HTML , <1> ( ). :

document.write("<2>; " + first + " " +second + "</2>");


, <SCRIPT>. 5.7 HTML.

5.7. HTML
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

<HTML>
<HEAD>
<1> </1>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
first = prompt(" ");
second = prompt(" ");
title = prompt(" ");
document.write("<Hl>" + title + "</1>");
document.write("<H2>CosflaHo: " + first + " " + second + "</H2>");
</SCRIPT>

13:
14:
15:

<> </>
</BODY>
</HTML>

, HTML .
. . , . 5.2.

70

II. JavaScript

fe < View go' Communicetoi *


:

Back

", -. ,

Retoad

Home

Search

Guide

Piint

Security

'} "'^ Bookmeiks ^ Locetiore[file ///Dl/JavaSae'E^jAo^? hind

PI
*

!;' ^jnaantHeMage ^ tntefnd ^J *-*UD lj NwACool

-
:

. 5.2. Netscape Navigator

,
JavaScript. , , . , .
JavaScript , . . .


Netscape missing semicolon before statement ( ). ?
, , - . JavaScript , . Function function.
var? ?
var
, . , .
. , , .
5- .

71

,
, var?
, . var
. , ,
, . ,
Web- .
?
, . .
( "7- . ").


1. ?

a) 2names
b) _first_and_last_names
c) FirtsAndLast
2. var fig=2 ,
?
a)
b)
c)
3.

31 + " "?

a)
b) 32
c) 31

1, a) 2names JavaScript,
. , )
.
2, ) , .
var .
3, ) 31
. (
.)

72

II. JavaScript


,
.
Greet ,
whol who2. . 5.4 , .
Average HTML.
alert . .
5.6 var name2
Greet)). ? , .
5.2. , .

5- .

4:
5:
6:
7:
8:
9:

</HEAD>
<BODY>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">;
testl = " . ";
test2 = " ";

6- .

75

, ^^,^,^
~- substringf), charA
.

10:
11:

test = testl + test2;


alert(test);

12:
13:
14:

</SCRIPT>
</BODY>
</HTML>


,
. Netscape Navigator,
, . 6.1.


substring!) ,
, . ,
46 test:

document.write(test.substring(3,6));
, 3 6. ,
, substring!).
0.
3.
.
5, 6.
.
. (6,3) .
. alpha:
alpha = "ABCDEFGHIGKLMNOPQRSTUVWXYZ";
substring!):
alpha.substring(0,4) ABCD
alpha.substring(10,12) KL
alpha.substring(12,10) KL. 10<12,
alpha.substring(6,7) , G
alpha.substring(24,26) YZ
alpha.substring(0,26)
alpha.substring(6,6) . , , , .


c h a r A f ) . . 0.
alpha:
alpha.charA(O)
alpha.charA( 12)
alpha.charA(25) Z
alpha.charA(27) ,
.

, . test :

location = test.indexOf("");
JavaScript , . , .

, location, , .
0.

, . , temp, 20- :

location = temp.indexOf("",19);
indexOf () .
, ,
.

, lastlndexOf (), , .
,
names:

location = names.lastlndexOf("");
indexOf ( ) , . , .


, ,
. , score . , ,
.


JavaScript , . , 30 :

scores = new Array(30);


, . 0,
029.
:

scores[0]
scores[l]
scores[2]
scores[3]

=
=
=
=

39;
40;
100;
49;

6- .

79

length.
, .
. scores:

document.write(scores.length);


.
,
. , scores:
scoredisp = ": " + scores[0] + "," + scores[l] + "," + scores] 2] + "," +
scores [3];

document.write(scoredisp);

, , , ; . ,
.
"8- . - : ".


. JavaScript, , . .


,
( JavaScript ):

names = new Array(30);


:

names[0] = "";
names[l] = "";
,
.
. ,
names:

document.write(names[0].substring(0,5));


JavaScript split;),
. ,
, :
test = "";

parts = test.splitf""};

80

II. JavaScript

test .
split() .
:
parts[0 ] = ""
parts[l] = ""
parts[2] = ""
JavaScript : j o i n ( ) . , split)).
parts :

fullname = parts.join("H");
, .
. . ,
.


JavaScript sort ( ) , . . ( ),
( ). ,
:

names[0] = "Public, John Q.";


names[l] = "Tillman, Henry J.";
names[2] = "Clinton, Bill";
names[3] = "Mouse, Micky";
sortednames = names.sort();
sortednames
names.


"3- . JavaScript" , JavaScript
, .
,
. ,
.
,
. msg.
(
, ):

msg = " . ?"


spacer.
msg:
spacer = " . . .
";

6- .

81

, ,
. pos 0.
ScrollMessagef).
6.2 .

6.2. ScrollMessage( )
1:
2:
3:
4:
5:

function Scroll-Message! ){
window. status =msg. substring (pos, msg. length)
+ spacer + msg.substring(0,pos) ;
pos++;
if (pos > msg. length) pos = 0;
window. setTimeout("ScrollMessage( )",200);

.
1 ,
.
2 ,
.
msg ( pos ),
msg ( pos).
3 pos .
4 pos
msg. , pos ,
0. ( if .)
5 window. setTimeout, ,
.
ScrollMessage 2 .
6

.
, <SCRIPT> HTML, Web. 6.3 Web- .

6.3. HTML
1:

2:

3:

4:
5:
6:
7:
8:

9:
10;
82

<HTML>

<><!> </1>
<SCRIPT LANGUAGE=" JavaScript">

var msg = " .


?";
spacer = ". . .
.. .";
pos = 0;
function ScrollMessage () {window. status =
msg. substring (pos, msg. length) + spacer +
msg. substring) 0, pos);
pos++;
if (pos > msg. length) pos = 0;
II. JavaScript

11:

window.setTimeout("ScrollMessage()",200);

12:

13:
14:
15:
16:
17:
18:

ScrollMessage();
</SCRIPT>
</HEAD>
<BODY>
<1> </1>
(
- ).
</BODY></HTML>

19:

. 6.2 6.3.
tv Netscape
fie

<

;;

' . . ' . '*. Bint


* Security
sf Stop
ii
Bck ' '-:- Refoad Home Search Guide

fio

Communicata fcjefe

Pi

l3html
j imtant Menage [41 Interne j lookup ^ !


( - ).

. 6.2. ,

JavaScript. . ,
.
. if
JavaScript .

6- .


? , , ?
. JavaScript .
JavaScript ?
( ). JavaScript
, , . "11- . ".
. ?

, . . (
"14- . ").


1. test ,
test.length?

a) 4
b) 10
c)
2. eagle ?
a) test.substring(4,9)
b ) test.substring(5,9)
c) test.substring("eagle")
3. join ?
a)
b)
ic) .

1, ) 10
2, ) test.substring(4,9).
,

3, ) join

84

II. JavaScript


, .
JavaScript
. JavaScript "2-
. ". Netscape
Navigator javascript:.
,
.

6- .

85

7-

,
. , .

JavaScript. .
if


else


86

II. JavaScript

if
.
.
if JavaScript .
.
. ,
.
If the phone rings, answer it. ( , .)
: If the phone rings (
) answer it ( ). if JavaScript . if:
if (a == 1} window.alert("l !");
( ),
( ).
. , . .
. , {}. 7.1.

7.1. if,
1:
2:
3:

if ( == 1) {
window.alert("l !");
= 0;

4;

.
1, 0.


if, , , , , . .
(
1). , .
,
. .
(, , , .)

. , .
JavaScript .
== ()
!= ( )
< ()
> ()
<= ( )
=> ( )

7- .

87

(==)
(=). ,
, .
JavaScript.



. JavaScript
, , . :
if (phone == " ") window.alert("!");
if (email == " ") window.alert("!");
:
if (phone == " " ! ! email == " " ) window.alert("!");
(! !).
: " , ".
,
(&&). :
if (phone == " " && email == " ") window.alert( "!");
| | &&. , (.. , ). , .
& .
, . . .

, ,
(!). , ,
() . :
if (phone != " ") window.alert("!");
! (!=).
. , , .
.
. , < 10 &. >20
. , :
" 10 20". . && ! !.

88

II. JavaScript

else
, i f ,
else. (else ),
, . 7.2 else.

7.2. if else
1:

if (a == 1) {

2:

alert("l ");

3:
4:

= 0;
}

5:
6:

else {
alert(" : " = );

1:

0. ( 1), .
if, else . .


if JavaScript .
, (,
). :
= () ? : ;
.
, .
:
value = ( == 1 ) ? 1 : 0;
, , if:
if (a == 1)
value = 1;
else
value = 0;
, , . ,
, . else, .

. counter:
document.write("" + counter + (counter = = 1 ) ? " ." : " . " ) ) ;
counter 1, 1 . counter 2 , 2 .
7- .

89


, if. 7.3 .

7.3. if
1:

if (button==" ") window.location=next.htm;

2:
3:
4:

if (button==" ") window.location=prev.htm;


if (button==" ") window.location=home.htm;
if (button=="Hasafl") window.location=back.htm;

,
.
if, JavaScript switch. ,
. 7.4 switch, , 7.3.
switch JavaScript 1.2. ,
, , . , JavaScript: <SCRIPT
LANGUAGE'"JavaScript 1.2">.

7.4. switch
1:
2:
3:
4:
5:
6:
7:
9:

10:
11:
12:
13:
14:
15:
16:

switch(button) {
case " " :
window.location="next.html";
break;
case " " :
window.location="prev.html";
break;
case " " :

window.location="home.html";

break;
case "" :
window.location="back.html";
break;
default :
window.alert("He .");

switch .
switch. (
button), .
{}. , if.
case. ,
, , .
, , case.
case.
break,
case.

II. JavaScript

default. ,
case .
case .
. case
, , break.


switch Web-, ,
, .
, Web-.
, . , .

prompt(). ,
. :
where = prompt(" ?");
switch, :

switch (where) {
case "Netscape" :
window.location="http://www.netscape.cora";
break;
case "Microsoft" :
window.location="http://www.microsoft.com";
break;
case "Yahoo" :
window.location="http://www.yahoo.com";
break;
default,
:
default :

window. location" http: / / www. mcp. com";

}
switch, break. switch.
7.5 HTML. Web-, . , . 7.1. , . , Web- .

7- .

91

-'

if

Back

-_=$ * Bockinaiks

!(*

Relwd

Home

Search

Jk Locaeion:^iilr/,',': [

*s>

Guide

Ptirt

i*

Seem*

i!

Stop

7_5hfnJ

'' Wcmrt '__j Lookup _j New&Cod

r.w.i.i:^fjm^-;ri-nm

. 7.7. ,

7.5.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
92

<HTML>
<1> </1>
</HEAD>
<BODY>
<1> </1>
.<BR>
<SCRIPT LANGUAGE="JavaScript 1.2">
where = window.prompt(" ?");
switch (where) {
case "Netscape" :
window. location3" http: / /www. netscape. com";
break;
case "Microsoft" :
window. location3" http: / /www. microsoft. com";
break;
case "Yahoo" :
3
window.location "http://www.yahoo.com";
break;
default :
window.location="http://www.mcp.com";
}
</SCRIPT>
</BODY>
</HTML>
II. JavaScript


JavaScript if else.

switch.
HTML,
.

. JavaScript .


, ,
(, )?
JavaScript .
, . JavaScript 1.3 ===, , . , .
, == =?
. ,
if ( = 1) 1.
.
7.5 JavaScript 1.2?
switch JavaScript 1.2. ,
.


1. if (fig==l)?
a) f i g 1
b) ,

c) , ,

2. " "?
a) !
b) !=
c) <>
3. switch?
a)
b)
c) if
7- .

93


1, ) , ,
2, ) !=
3, ) switch

if ,
. , , , 7.5 . , , netscape Netscape, www.netscape.com.
, ,
. ( toLowerCasef), "6- . ",
, .)

II. JavaScript

8-
- :

II . JavaScript.
, .
.
for
while
do while for


f o r . . .in

8- . - :

95


for , . for
( ),
, .
. for :
for (var = 1; var < 10; var ++) {
for .
(, var = 1)
. ,
.
(var < 10) , ,
. .
(var ++) ,
. ,
.
, .
. , ,
.
if, , .
, ,
for, .
for 8.1.

8.1. for
1:
2:
3=

for (1=1; i<10;


document. write (" ",i,"<BR>") ;
}

. :
1
2
3
4
5
6
7
8
9
, . , i<10. 10, .
, i<=10 i<ll.

96

II. JavaScript

, i . , , Forth. ,
. ( Forth , Forth Interest Group www.forth.org.)
for JavaScript Java, , ,
. , ,
. , , while, .

while
, JavaScript ,
while. for, while . , , . , , .
while .

. 8.2 while.

8.2. while
1:
2:
3:

while(total < 10) {


total +=values[n];

, . , , 10.
, for:
for (n=0; totaKlO; n++) {

total+= values[n];
}

for , while, .
for while. .
... .

8- . - :

97

do...while
JavaScript 1.2 : do..while.
while. . do...while . 8.3
do.. .while.

8.3. do.. .while


1:

do {

3:

total += values[n];

4:

5;

while(total < 10);

, , , ,
8.2. .
,
8.2 . , , .
for while, do.. .while
, .


,
. break
continue, .


for while . , ,
. 8.4.

8.4.
1:
2:
3:
4:

while(j<10) {

++;
values [n] = 0;

. j. , ,
. .
.
.
.
II. JavaScript

, . , JavaScript .
, .

"" , . .

. .
break, . :
while (true) {
true , JavaScript .


. break. 8.5
break.

8.5. break
1:

while (true) {

2:

n++;

3:

if (values[n] == 1) break;

4:

while . if
. , .
break JavaScript
, . break , , .
.


, continue
,
. 8.6 .

8.6.
1:
2:
3:
4:

for (i=l; i<21; i++) {


if (score[i]==0) continue;
document. write (" ",i, ": ", score[i], "\n");

8- . - :

for, 20
, score. if
. , 0
, . ,
.

for...in
JavaScript. for.. .in
, for while.
.
, navigator , (
"16- . ").
f o r . . . in:

for (i in navigator) {
document.write(": ", + i);
document.write(": ", + navigator[i]);
}

for (
i). -, .
.
, . "11- .
".


, , , . (
, , .)
, . . :

names = new Arrayf);


i=0;
, .
, , . i .
prompt. , . , do:
do {

next = prompt(" ");


if (next > " ") names[i] = next;
i = i + 1;
}
while (next > " ");

100

II. JavaScript

, i = i
+ 1 ++.

next.
( ) names. , Cancel ().
, , :
document.write("<H2>" + (names.length) + " .</2>");
length names, .
. , f o r . . .in:

document.write("<OL>");
for (i in names) {
document.write("LI" + namesfi] + "<BR>");
}
document.write("</OL>");
for...in, . .
<>, .
.
8.7 HTML,
.

8.7.
1:
2:

<HTML>
<HEAD>

3:

<1> </1>

4:

</HEAD>

5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

<BODY>
<1> </1>
<> .
.</>
<SCRIPT LANGUAGE="JavaScript 1.2">
names = new Array));
i = 0;
do {
next = prompt(" ");
if (next > " ") names[i] = next;
i = i + 1;
}
while (next > " ");
document.write("<H2>" + (names.length) + " </2>");
document.write("<OL>");
for (i in names) {
document.write("<LI>" + names[i] + "<BR>");

8- . - :

22:
23:
24:
25:
26:

document.write("</OL>");
</SCRIPT>
</BODY>
</HTML>

,
. , Cancel
(), . 8.1 HTML.
<52 Mtcrtuutt Internet xpfeti

/ - -* $ $

&

j D.\J*vaSctiptKpb\Lel\8_7.bt,-nl

6
1.
2.
3.
4.
5.
6.

ii

. 8.1. 8.7

for while .
for...in,
.
II , JavaScript. III JavaScript .

102

II. JavaScript


, for (while, do ..).
?
. for .
, .
JavaScript 1.1. do.. .while?
. while,
if . , break .
.
?
.
"14- . ".


1. ?

a) for
b) while
c) do...while
2. break, ?
a)
b)
c)
3. while (3 == 3)
a)
b)
c) JavaScript

1, ) do.. .while
2, ) break
3, )

8- . - :


, .
8.7 ,
. sort,
. "6- .
".
8.7 ,
. , Cancel ()
.

104

II. JavaScript

III

JavaScript

9.

10.
11.
12.

9-

III . (
, , , .) JavaScript .
. Math Date. .
JavaScript


Math
Date

106

JavaScript

III. JavaScript


,
() (), .
Math Date. , JavaScript.


JavaScript , , . , String
String. :

myname=new String)"");
new JavaScript , , String.
myname.
: String, Date,
Array . ( Math .
.)
,
"11- . ".


, . , . . .
. length . ,
, (), . ,
names :

names.length
. ,
, .
, , :

names[0].length

"4- . JavaScript", , . , .
. , toUpperCase String , .
:

value.toUpperCasef);
9- .

107

, . , round Math
final:

final = Math.round(num);

with
with . JavaScript
, , .
with .
. , ,
with .
, lastname.
, with:

with (lastname) {
window.alertf" : " + length);
toUpperCase));
}
length toUpperCase
lastname, with.
, with .
.
,
, Math.

Math
Math JavaScript ,
. Math,
. Math
, .
Math
, with, .


Math .
Math.ceilf).
Math.floor().
Math.round().
.
: ,
, (, ). 9.1 , .

108

III. JavaScript

9.1.
1:
2:

function round(num) {
return Math.round(num * 100) / 100;

3:

100.
. 100.
, .


Math .
Math.random)), .
. .
,
1 . . 9.2 ,
1 .

9.2.
function rand(num) {
return Math.floor(Math.random() * num) + 1;

}
:
, Math.random(), Math.floor().


, , Date. JavaScript
. Date ,
, :
Date "2- . " . Date
. Date, , .
JavaScript , :00 01.01.1970.
. JavaScript
. , Date , , . ,
, .

9- .

109

Date
Date , JavaScript, new. ,
. :

birthday = new Date();


birthday = new Date("June 20, 1999 08:00:00");
birthday = new Date(6, 20, 1999);
birthday = new Date(5, 20, 1999, 8, 0, 0);

, . ( ), .
Date set, .

Date
Date set.
setDate ()
setMonth() . JavaScript
0 11.
setYear ()
setTime() ( ),
1970
setHours(), setMinutes() setSeconds() ,

, Date holiday 99:
holiday.setYear(99);

Date
get , Date.
Date, . JavaScript .
getDate().
getMonth().
getYearf).
getTime (). ,
1970
getHoursf), getMinutes() getSeconds(). ,

setFullYear getFullYear, , JavaScript setYear
getYear, , .
" 2000 ",
.

110

III. JavaScript


, JavaScript
.
getTimezoneOffset().
( ).
Windows . (

1~1 ( ) Control Panel ( ).)
toGMTString (). Date
UTC ( ).
toLocalString(). Date .


JavaScript
Date. Date,
Date.
Date.parse(). , Jun 20, 1996, Date ( , 1/1/1970).
Date.UTC(). . Date ( ) (:
: ).

Math
Math.random, ,
01. , . ( , .)
. Math.random?

.
0,5.
, 0,5.
Math.random ,
. 5000
.
"8- . :
" ,
. ( , .)
total. . 0:
total = 0;
9- .

, 5000 .
, for:
for (1=0; i<5000; 1++) {


total. :
num = Math.random));
total += num;
}
5000 . ,
, ,
, :

window.status = " " + i + " . : " + total;


(
total 5000).
. , :

average = total / 5000;


average = Math.round(average * 1000) / 1000;
document.write("<2> : " + average +
(
60 ) (.. ).
.

, HTML, <SCRIPT>. 9.3 Web- .

9.3.
1:
2:

<HTML>
<HEAD>

3:

<1> Math</TITLE>

4:
5:

</HEAD>
<BODY>

6:
:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
112

<1> Math</Hl>
<> ,
7
5000 .</>
<SCRIPT LANGUAGE="JavaScript">
total = 0;
for (1=0; K5000; i++) {
num = Math.random();
total += num;
document.status = " " + i + " ";
}
average = total / 5000;
average = Math.round(average * 1000) / 1000;
III. JavaScript

19:
20:

document.write("<H2>Cpen.Hee
: " + average + "</H2>");
</SCRIPT>

21:
22:

</BODY>
</HTML>

, Web-
. . 5000 .
0,494, . 9.1.
Math Nettcarm

$e tft go

^*

3 >
-.** * Flint
^ Secu^y
tf -;:
Seech Guide

:; ' Retoad

8<X*mkt ^. LocHon-p^/^VjavaSc^Ei^i^5^
tan* Msauge M' irtfwnW ^j Lookup ^j HewACooi ".

Math
, ? 5000

: .494

.&' :|

. 9.1.

^r F>

, , .

.
0,5. , 2500
0,4 2500 0,6, 0,5. .

.

9- .

113


JavaScript , III.
Math Date, .
, JavaScript .
JavaScript . HTML.


?
. .
(, window.location) .

, Math . , .
Math ,
Math.PI Math.E. , . Math ( ) .
Netscape Navigator .

9.3 .
. ?
.
,
. , ,
.


1. new?
a) Date
b) Math
c) String

2. Date?
a) 1970

b) 1900
c) Netscape
3. Math.random?
a)

0-100

b) 1
c) 0-1
III. JavaScript


1, b) Math . Math
2, ) 1970
3, ) JavaScript 0 1


JavaScript, . .
9.3 ,
.
9.3 ,
15 5000 .

9- .

10-

,
. JavaScript, , (Document Object Model DOM), , .
HTML, .
.
.
DOM
window
Web- document

URL location
navigator
Back () Forward ()

116

III. JavaScript


JavaScript, , , . Web-, , .
, JavaScript (DOM). , Web-: , , ..
DOM, , , Web, , .
, . , (), . , , Web-, document.
image9, document, ,
, window:

window.document.image9
window . . 10.1
DOM
.

window,
parent, framesQ, self,
top

. 10.1. DOM JavaScript


- , . , .

10- .

117

DOM
1.1 ( Netscape 2.0), JavaScript , HTML . . Netscape Navigator Internet Explorer , ,
. -.

Netscape Microsoft. .
Netscape Navigator 3.0 Internet Explorer 4.0 (
) .
W3C (World Wide Web Consortium
Web) DOM.
, HTML, , XML.
DOM Netscape, Internet Explorer.
Netscape Navigator 6.0 Internet Explorer 5.0
.
, , , DOM.
, ,
DOM . DOM 1 DOM 2 DOM 0. DOM
.

window
window. .
.
window, status .
window.alert, window.confirm window.prompt
.
window, . window. "13- . ".
, Web-,
window. "18- .
DOM".

Web-
document Web- Web-. , ,
document window. , document, ,
window.
III. JavaScript

Web- document.write. , ,
,
window.document.write. .


window document.
.

document, .


document .
URL Web-.
. .
, window, location,
.
title ,
<TITLE>.
referrer Web-,
Web-. ,
.
lastModif ied Web-.
Web-
.
10.1 HTML, .

10.1.
1:
2:
3:
4:
5:
6:
7:
8:
9:

<><>><1.> </1></>
<BODY>
:
<SCRIPT>
document. write (document. las tModif ied);
</SCRIPT>
<BR>
</BODY>
</HTML>

Web.
.
lastModified Web-.
,
.

10- .


document , .
. document.write
. ,
Web-.
document.writeln
/. ,
. document.writeln , .
, <HTML>
. , , <PRE>.
, <BR>.

Web- . . , ,
Web- DOM, . "19-
. DOM".

document.write <SCRIPT>,
HTML. , HTML.


Web-
document open close.
window, document
. , . open
,
write writeln.
document.open . , , . .
, document.open,
, document.close, . JavaScript write,
.
document.open , ,
HTML, .
.
13.

document.open MIME.
, , . "20-
. ".

120

III. JavaScript

MIME Multipurpose Internet Mail Extensions ( Internet). Internet . Web- MIME ,


Web-. HTML (
text/html).


document, ,
link. document
link. .
HTML, . : < NAME="part2">. : < HREF="ipart2">.
link links. link . document.links.length
.
link ( links) , , .
location, . link
. LJRL
linkl:

linkl = links[0].href;

document. HTML HTML.
, anchors. anchor. document.anchors.length
HTML.


document , , history.
,
, .
history .
history, length. ,
history. ,
Web-.
history.current. URL ,
.
history.next. URL ,
,
Forward (). ,
Back (),
.
history.previous. URL ,
,
Back ().

10- .

121

history .
URL .
history[0]. history. .
history.go.
,
history. , history.go(-2)
Back ().
history.back. ,
. Back ().
history.forward. ,
( ).
Forward ().
history.back history.forward Netscape Navigator .
history.go (history.go(-l) history.(1)).

location
document location.
HTML, . ,
:

window, location. href="http: //www. starlightech. com";


href, , URL , . URL, location.protocol ( http:).
location .href URL, document. URL,
, .
location.href.
location .
location.reload. .
Reload (), .
location.replace. .
location . ,
. , Back ()
.


navigator .
.
, .
, .
navigator Netscape Navigator,
, JavaScript. ,
Internet Explorer.

122

III. JavaScript

, , . navigator "16- . ".

Back Forward
back forward
Web- , .
history , HTML Back () Forward (),
Web. Back Forward .
.
, Back:
< HREF=" javascript: history. go( -!);">
<IMG BORDER=0 SRC="lef t.gif ">
javascript: URL, Back. Back
. Forward :
< HREF="javascript:history.go(l);">
<IMG BORDER=0 SRC="right.gif ">
</A>
. .
HTML. 10.2 HTML
Back Forward. . 10.2 Netscape Navigator
. Back Forward.

10.2. HTML,

1:

<HTML>

2:

<><1> Back Forward</TITLE>

3:
4:

</HEAD>
<BODY>

6:

<HR>

5:

<1> Back Forward</Hl>

7:
8:
9:


Back Forward.
.

10:

<HR>

11:
12:

< HREF="javascript:history.go(-l);">

13:

</A>

16:

</A>

14:
15:

17:
18:
19:

<IMG BORDER=0 SRC="left.gif ">

<A HREF="javascript:history.go(l);">
<IMG BORDER=0 SRC="right.gif ">

<HR>
</BODY>
</HTML>

10- .

123

b) DOM
c) DOM

1, )
window.location
2, ) navigator
3, b) DOM 0.

10- .

125

' * -a,-ft <*. t; .* *

-..flack'- ''-..','

Paired

Home

Search

Lacet-vi .

Guide

Pir

^-'

Wemet J LX*J*

Back Forward
Back Forward

, .
Reload
(), Back Forward. (
location.reload().)
10.2 , Web-
.

126

III. JavaScript

11-

JavaScript , , , Date. .
JavaScript. .
, , JavaScript,
. .




11- .



JavaScript , . , , ,
.
: , ..
. .
.
, : , , .. . , , .
, , ( ). Card,
, name, address phonenumber.
, .
Card . .


.
Card. Card :

name
address
workphone
homephone

, Card.
. Card:

function Card (name, address, work, home) {


this.name = name;
this.address = address;
this.workphone = work;
this.homephone = home;
}
,
. , . Card,
Card.
this. . , ..
, .

128

III. JavaScript


.
Card , , . PrintCard.
PrintCard Card.
. ,
this . PrintCard:
function PrintCard() {
1=": " + this.name + "<BR>\n";
112=": " + this.address + "<BR>\n";
line3="Ten.(p): " + this.workphohe + "<BR>\n";
4=". (): " + this.homephone + "<BR>\n";
document .write (1 inel, Iine2, Iine3, Iine4);

.
,
(), Card. ,
, PrintCard Card.
:

function Card(name,address,work,home) {
this.name = name;
this.address = address;
this.workphohe = work;
this.homephone = home;
this.PrintCard = PrintCard;
>
, PrintCard. PrintCard , PrintCard Card.


. ,
. new. Date Array.
Card, torn:
tom=new Card("Ton ", "123 Elm Street", "555-1234", ""555-9876");
, . , , Card ,
.
, . Card. , .

new, . 11.1 Card .
11- .

129

11.1.
1:
2:
3:
4:
5:

holmes = new Card();


holmes. = " ";
holmes.address = "221 Baker Street";
holmes.workphone = "555-2345";
holmes.homephone = "555-3456";

, ,
PrintCard.
, , , torn:

tom.PrintCardf);


JavaScript , . , , String
, , . .
; prototype. ( ,
, prototype , ,
.) prototype
.
String .
heading, HTML.
:

title = " ";


title
HTML :

document.write(title.heading(1));
11.2 heading
String .

11.2. String
1:
2:
3:

<HTML>
<><1> </1>
</HEAD>

4:

<BODY>

5:
6:
7:
8:
9:
10:
11:
12:
13:

<SCRIPT LANGUAGE"JavaScriptl.l">
function addheadflevel) {
html = "H" + level;
text = this.toStringf);
start = "<" + html + ">";
stop = "</" + html + ">";
return start + text + stop;
}
String.prototype.heading = addhead;

130

III. JavaScript

14:
15:
16:
17:

document.write(" TecT".heading(l));
</SCRIPT>
</BODY>
</HTML>

addhead(),
String. .
start stop <HTML>
( ).
String prototype. String, .
String
HTML .


,
. , ,
Web- .
HTML
PrintCard, Card. Card Web-. 11.3 .

11.3. HTML, Card


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

11:
12:
13:
14:
15:
16:
17:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function PrintCard() {
1="<>: </>" + this.name + "<BR>\n";
2="<>: </>" + this.address + "<BR>\n";
line3="<B>Ten.(p): </B>" + this.workphohe + "<BR>\n";
4="<>.(): </>" + this.homephone + "<BR>\n";
document.write(Iinel,line2,line3,line4);

}
function Card(name,address,work,home) {
this.name = name;
this.address = address;
this.workphohe = work;
this.homephone = home;
this.PrintCard = PrintCard;

18:

19:
20:
21:
22:
23:
24:

</SCRIPT>
</HEAD>
<BODY>
<1> </1>
.<HR>
<SCRIPT LANGUAGE="JavaScript">

11- .

13

//

25:
26:
27:
28:

sue-new Card( " ", "123 Elm Street", "555-1234", "555-9876");


s
phred new Card (" ", "233 Oak Lane", "555-2222", "555-4444");
henry=new Card( " ", "233 Walnut Circle", "555-1299",
"555-1344");
//

29:
30:
31:
32:
33:
34:
35:
36:

sue.PrintCard();
phred.PrintCardf ) ;
henry. PrintCard() ;
</SCRIPT>
<
</BODY>
</HTML>

, PrintCard() ,
. Web-
11.3 . 11.1.
,
. , Card
, . .

fletoed Hone

SeatcH

Gukfc

f-'

Inriwit Mestage $ Internet ^J Lookup {j


.
;
Aflj.ft: 123 Elm So-set
1.(): 555-1234
fa) 555-9876

: 233 Oak Lane
.) 555-2222
.() 555-4444

. 233 Walnut Circle
IM.(|I). 555-1299
.(): 555-1344

-J.J

. 11.1. Netscape Navigator

132

III. JavaScript


JavaScript . ,
, , ,
. , JavaScript.
III.
,
, , ..


10 . ?
. . , Nicknames,
, Card,
Card : this.nick = new
Nicknamesf);
?
. , .
(, cardarray[l]= new Card).
?
JavaScript 1.1. Netscape Navigator 3.0 Internet Explorer 4.0.


1. JavaScript ?
a) object
b) new
c) instance
2. this?
a)
b)
c)
3. prototype?
a) JavaScript
b)
c) ,

7 7 - .


1, b) new
2, ) this
3, ) prototype

, .
Card email,
.
PrintCard .
, firsts,
String. substring,
"6- . "

134

III. JavaScript

12-

. . 24-.
, , .
,
Java Script. , ( ), .
.
.
JavaScript






Web-

2- .

135


JavaScript
"4- . JavaScript",
HTML .
. , , , , ..
.
,
, .
JavaScript. . , ,
.


"10- . ", JavaScript . : , ,
, ..
HTML. ,
, .
. , onMouseOver Web-. onMouseOver .
, on. , onMouseOver
.
, <>.
onMouseOver.
. on ,
.


<SCRIPT>. ,
HTML. onMouseOver:

< HREF=" http: / / j sworkshop. com/"


onMouseOver="window.alert(' ');">
</>
, <> .
onMouseOver . .

136

III. JavaScript


. , . ,
. ( , , .)

. ,
. ,
:

< HREF=" it bottom" onMouseOver="Dolt() ;"> </>


Dolt(). , , .
" " .
,
. , .

JavaScript
HTML, JavaScript. , .. .
, , . document , . mousealert, a
onMouseDown:
function mousealert() {
alert(" !");
}

document.onMouseDown = mousealert;

event
event JavaScript 1.2 . , . .
event , .
event.
type. , mouseover.
target. (, ).
which. ,
, .
modifiers.
,

( <Alt>, <Shift> <Ctrl>).

12- .

data. " ".


pageY. X Y .
.
layerX layerY. X Y . . ( Web "18- .
DOM".)
screenX screenY. X Y . .

,
JavaScript , . ,
.


, ,
onMouseOver. , Web-.
OnMouseOut . .
( ).
, Web- , . onMouseOver ,
,
.
( onMouseOut) .
onMouseOver onMouseOut
" " .
onMouseOver onMouseOut .
"15- . ".

onMouseMove .
, . , , .



. , . onclick.

.

138

III. JavaScript

. .
"14- . ".

, :
< HREF="http://www.jsworkshop.com"
onClick="alert(' Web-');"> </>
onclick .
.
onClick false, , , . , . Cancel (), ; , ,
:

< HREF="http://www.jsworkshop.com"
onClick="return(window.confirm;' ?'));"> </>
return, . false Cancel.
.
onDblClick .
, , . , . , . ( - .)
, .
, , , .
onMouseDown.
.
onMouseUp. .

. , onclick;
onMouseDown onMouseUp.

which. 1, 3.
onClick, onDblClick, onMouseDown onMouseUp.
onMouseDown, :

function mousealert(e) {
whichone = (.which == 1) ? "" : "";
message = " "+whichone+" ";
alert(message);
}
document.onmousedown = mousealert;

12- .

,
Netscape Navigator 4.0 JavaScript
. . , ,
.
JavaScript . , , onKeyPress.
. , KeyDown onKeyUp.
, , . event. event.which ASCII .
ASCII (American Standard Code for Information Interchange ) , . 0-128, . ,
65, a Z 90.
, fromCharCode . ASCII
. , <BODY>
, , :

<BODY onKeyPress="window.alert(' : 'tstring.fromCharCode(event.which));">


String.fromCharCode
event.which , .

onload
, , onLoad. Web- ( )
.
onLoad document. <BODY>.
<> :

<BODY onLoad="alert(' ');">


onLoad HTML,
document.write document.open.
, .

JavaScript .
( "14- .
"). , , onError.
.
"21- . JavaScript".

140

III. JavaScript


. ,

" ".
, ,
onMouseOver. , .
( onMouseOut).
.
, ,
URL. , , URL. , Web- . ,
" ".

, . , . , , , :
< HREF="order.html"
onMouseOver="window.status=' '; return true;">
Order Form</A>
return true
URL. , <> .
. ,
(, ).
describe ( 12.1).

12.1. describe
1:
2:
3:
4:

<SCRIPT LANGUAGE="JavaScript">
function describe(text) {
window.status = text;
return true;

5:

6:

</SCRIPT>

text. . true, URL. , ,


onMouseOut, 12.2.

12.2.
1:
2:

function clearstatus() {
window.status="";

3:

12- .

, HTML , . 12.3 HTML .

12.3.
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:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function describe(text) {
window.status = text;
return true;
}
function clearstatusf) {
window.status="";
}
</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<> ,
</>
<UL>
< HREF="order.html"
onMouseOver="describe(' '); return true;"
onMouseOut="clearstatus()";>
</>
<>< HREF="email.html"
onMouseOver="describe(' '); return true;"
onMouseOut="clearstatusf)";>
EmaiK/A>
<LIXA HREF="coraplain.htmr'
onMouseOver="describe( ' '); return true;"
onMouseOut="clearstatus()" ;>
</>
</UL>
</BODY>
</HTML>

.
onMouseOver OnMouseOut, .
, 12.3 .
, . 12.1.

142

III. JavaScript

|( '3) internet :^j Loc*up -_j NewI-Cu^

. 12.1. Web-

,
.
.
. .
Web-. , , , ..


, <IMG>
onMouseOver onclick. , ?
,
<>. ,
BORDER=0. 15.
, onKeyPress onKeyDown?
?
onKeyDown. true, onKeyPress. .
12- .

143

onLoad
, . ?
JavaScript. , setTimeout. "13- . ".


1.
?
a) onMouseUp
b) onLink
c) onClick
2. onLoad?
a)
b)
c)
3. onLoad
HTML?
a)
b) HTML
c)

1, ) onClick
2, ) onLoad ,
,
3, ) onLoad HTML

,
.
HTML 12.3.
, .
12.3 , ,
, . (:
.
clearstatus.)

144

III. JavaScript

IV

Web-

13.
14.
15.
16.

13-

IV .
, ,
JavaScript. Web-
JavaScript.
.
. .
window
JavaScript

,
JavaScript
JavaScript

146

IV. Web-


"10- . " ,
HTML. . window , a document, history location .
window. , , . , .
.
window ( , ). self.

.


. , , .
(, ).
window.(). :

WinObj=window.open("URL", "WindowName", "Feature List");


window.open() .
WinObj window.
window.
window.method URL ,
. , .
(WindowName).
name window.
, .
:
, .
"" , .
window.() width height, , toolbar, location, directories,
status menubar, (1) (0). , ;
. ,
:
SmallWin =
window.open("", "small", "width=100, heigth=120, toolbar=0,status=0");
, Web. Web , , ,
.

13- .

147


, . window. close() .
Netscape Navigator. . ,

updatewindow:
updatewindow.close();

( 13.1) HTML, . ( .
.)
.
() . Netscape Navigator , .

13.1. HTML,

1:

<HTML>

2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

<><1> </1>
</HEAD>
<BODY>
<1> </1>
<HR>

<HR>
<FORM NAME="winform">
<INPUT TYPE="button" VALUE=" "
onClick="NewWin=window.open('','NewWin',
'toolbar=no,status=no,width=100,height=200');">

13:

<PXINPUT TYPE="button" VALUE=" "

14:

15:
16:
17:
18:
19:
20:

onClick="NewWin.close();">

<P><INPUT TYPE="button" VALUE=" "


onClick="window.close));">
</FORM>
<HR>
</BODY>
</HTML>

.
. . 13.1
13.1 . .



. JavaScript ,
. window. setTimeout
.

148

IV. Web-

.
, setTimeout() .
, .

Reload

Home

Sech

Guide

".; Instant ! Internet .jj[ Lookup '^j NwACod

. 13.1. , Netscape Navigator JavaScript

setTimeout(). . JavaScript ( ),
. ( ). ,
10 :
ident=window.setTimeout("alert('Banie ')", 1000);
, . ,
, (),
.

( ident) . .
clearTimeout() . :

window.clearTimeoutfident);

13- .

149


, setTiraeout ( ) .
. ,
, .
setTimeoutf). 13.2 .

13.2.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

<HTML>
<><1> </1>
<SCRIPT>
var counter=0;
// 2
ID=window.setTimeout("Update();", 2000);
function Update()
{
counter++;
window.status="OTC4eT"+counter;
document.forml.inputl.value=": "+counter;
//
ID=window.setTimeout("Update();", 2000);

13:

14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:

</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<HR>
2
RESET , STOP .
<HR>
<FORM NAME="forml">
<INPUT TYPE="text" NAME="inputl" SIZE="40"><BR>
<INPUT TYPE="button" VALUE="RESET" onClick="counter=0;"><BR>
<INPUT TYPE="button" VALUE="STOP" onClick="window.clearTimeout(ID);"><BR>
<HR>
</BODY>
</HTML>


. . Reset, Stop.
setTimeoutf) .
, ..
. Update().
. Reset , a Stop clearTimeoutf).
. 13.2 13.2.

. HTML. .

150

IV. Web-

<tt v*w

-i'

Bee*

.-

.,^'Baokmaiks

'3. ^

fldoed

Ht-m

.$ location jli

Inn** Message ^f trtetntt _j Lod'-^p Jj


2 RESET , STOP
.

|: 6
SESET j
STOP i

. 7J.2. ,


window , . .
alert , . 13.3.
.
!11
?\

pi (

|::::::| ^
. 13.3. , JavaScript

. 13.4.

confirm
. Cancel (),
. . 13.4.
prompt .
.

13- .

151



13.3 HTML, .

13.3. HTML, ,

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:

<HTML>
<><1> </1>
</HEAD>
<BODY>
<1> </1>
<HR>

<HR>
<FORM NAME="winform">
<INPUT TYPE="button" VALUE=""
onClick="window.alert(' ');">
<PXINPUT TYPE="button" VALUE=""
onClick="temp=window.confirm('?');
window.status=(temp)?'confirm:true': 'confirm:false';">
<P><INPUT TYPE="button" VALUE=""
onClick="var temp=window.prompt)' :',' ');"
window.status=temp;">
</FORM>
<> !
<HR>
</BODY>
</HTML>

Ha Web- , . .
.
.

(true false).
temp.
.
, prompt ,
, .
Cancel (), null.
. 13.5 13.4.
, , ().

152

IV. Web-


( Netscape Navigator Internet Explorer) ,
. URL .

*
Back

.
.. '

,. ' Baotaak*

^.

&

-&

Rokd

Home

Seatch

Guide

Pint

Security

ft

$ tocatiort{l4e//7Dl/JavaScripiExpls/Lisl/13^3 html

Instert Message ! Internet --Jj Uokup ^ NevACoof

' ! ]

. 13,5.


frame. frame .
NAME <FRAME>.
, window self ? .
parent .
frame
window. 13.4 HTML .
13.4. HTML
1:
2:
3:
4:
5:
6;

<FRAMESET ROWS="*,*" COLS="*,*">


<FRAME NAME="topleft" SRC="topleft.htm">
<FRAME NAME="topright" SRC="topright.htm">
<FRAME NAME="bottomleft" SRC="bottomleft.htm">
<FRAME NAME="bottomright" SRC="bottomright.htm">
</FRAMESET>

73- .

153

HTML .
topleft.htm, parent.topleft.
window seft topleft.
, :
window - , parent
, , a top , .

frames
,
frames. .
( 0) <FRAME>.
, 13.5
:
parent.frames!] topleft
parent.frames[l] topright
i
parent.frames[2] bottomleft
parent.fraraes[3] bottomright

. , . ,
, 10 , . .


, .
frame , , .
. . 13.6 , , .

13.5. HTML
1:
2:
3:
4:
5:
6:
7:
8:
9:

<HTML>
<HEAD>
<1> </1>
</HEAD>
<FRAMESET COLS="*,*">
<FRAME NAME="left" SRC="left.htm">
<FRAME NAME="right" SRC="about:blank">
</FRAMESET>
</HTML>

,
. 13.6.

154

IV. Web-

13.6. HTML
1:
2:

<HTML>
<HEAD>

3:
4:
5:

<1> </1></>
<BODY>
<>

6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24;



</>
<UL>
<LIXA HREF="|"
onClick="parent.right.location='order.html';
window,location='ordernav.html'; ">
Order Form<A>
<LI><A HREF="|"
onClick= "parent. right. location=' email.html';
window.location='emailnav.html';">
EmaiK/A>
<LIXA HREF="I"
onClick="parent.right.location='sales.html';
window.location='salesnav.html';">
Sales</A>
<LI><A HREF="#"
onClick="parent.right. location=' links. html';
window.location='linksnav.html'; ">
Other Links</A>
</UL>
</BODY>
</HTHL>

- JavaScript, . . ,
HTML :
onClick="parent. right. location=' order. html';
window. location=' ordernav. h t m l ' ; "
, Web- ,
. , parent.
, TARGET <>. JavaScript. , .
, . ,
HTML. 13.5. ( Web- www.jsworkshop.com.) . 13.6 .

73- .

Fte <ft XJie


Bad--

Foiward

fietoad

Hone

S*

!' Inslartt Message- ;9i Irtwwt _j Lookup _^j New&Cool


Document Done

. 7J.6.

window
. .
, HTML, .

Web- . form.


, , ?
Netscape Navigator 3.0 window.opener, , .
, Web- , ,
Netscape Navigator 4.0 . JavaScript?
. window.
"18- . " DOM".
?
, 13.6. , , .

156

IV. Web-



1.
Cancel ()?
a) window.alert
b) window.confirm
c) window.prompt
2. window. setTimeout?
a) JavaScript
b)
c)
3. , first, second
third. , ?

a) window.first
b) parent.first
c) frames.first

1, b) window.confirm
2, ) window. setTimeout JavaScript

3, ) parent.first

window HTML,
.
( "2- .
").
. JavaScript,
( )
.
13.5 13.6 ,
, .
. .

13- .

157

14-

JavaScript
. JavaScript ,
.
.
HTML

form

,

CGI

158

IV. Web-


, , Web-,
HTML. , JavaScript
. HTML.


HTML <FORM>. . <FORM>
.
NAME. . , .
JavaScript

METHOD. GET POST.
.
ACTION. CGI,
. mailto:.
.
, <FORM> Order.
GET CGI
order.cgi, , Web-:
<FORM NAME="Order" METHOD="GET" ACTION="order.cgi">
, JavaScript (, ), METHOD ACTION . <FORM>:

<FORM NAME="calcform">
<FORM> .
, , .
.

form
HTML form,
, NAME <FORM>.
forms. , . ,
0. , ,
f oral, :

document.forml
document.forms[0]

14- .

159

form
, form ,
<FORM>.
JavaScript. form.
action. ACTION ,
, .
encoding. MIME. ENCTYPE.
.
length. .
.
method. , , GET POST.
target. ,
( CGI).

.


form : submit reset.
, . , , ,
Web- .
submit . .


form : onSubmit onReset.
, <FORM>,
JavaScript , .
( ) onSubmit, ( )
CGI.
CGI, onSubmit
false. true,
. Reset, onReset.


form elements.
. . ,
( namel):

document.order.elements[0]
document.order.namel
160

IV. Web-

, .
, .

,
length, .
, document.forms.length , a document, forml.elements.length forml.


.
, . JavaScript,
.
:
<INPUT TYPE="TEXT" NAME="textl" VALUE="" SIZE="30">
textl.
30 . JavaScript text
textl.
.
.
name. , . .
defaultValue. , VALUE.
.
value. , .
.

, ,
.
username, . :
document.order.username.value="



,
. "


<TEXTAREA>
textarea. . . HTML:
<TEXTAREA NAME="textl" ROWS="2" COLS="70">

</TEXTAREA>
textl.
, 70 . JavaScript
textl,
form.
<TEXTAREA>
. , .
14- .

161


text textarea .
focus (). .
blur(). .
select ( ) . , .
. .
.
text textarea .
onFocus.
.
onBlur. .
onChange. .
onSelect.
. , ,
, . ( Select(),
, .)
<INPUT>.
onChange
:

<INPUT TYPE="TEXT" NAME="textl" onChange="window.alert)'');">

. <INPUT> .
type=SUBMIT. Submit.
CGI.
type=RESET. Reset.
.
type=BUTTON. . ,
JavaScript.
NAME
VALUE , . "13- . ". Submit, subl :
<INPUT TYPE="SUBMIT" NAME="Subl" VALUE=" ">
Reset Submit onReset Submit. onclick.

162

IV. Web-


, .
, . true false. <INPUT>. :
<INPUT TYPE="CHECKBOX" NAME="chekl" VALUE="Yes" CHECKED>
. VALUE
.
. on (). CHECKED .
. , .
name. checkbox .
value. on.
. JavaScript
checked.
defaultChecked. ,
CHECKED.
checked. . true
false.

. same order:

document. order. same. checked=true;


c l i c k f ) .
. onclick,
. ,
checked.

, , .
<INPUT> RADIO.
, , .
. :

<INPOT TYPE="RADIO" NAME="radiol" VALUE="Optionl" CHECKED> Option 1


<INPUT TYPE="RADIO" NAME="radiol" VALUE="Option2"> Option 2
<INPUT TYPE="RADIO" NAME="radiol" VALUE="Option3"> Option 3
. NAME
( ).
VALUE . ,
VALUE.
, . , , .

14- .

163

, , ,
. radio .
. .
length. .
, radio.
. .
value. , . ( .)
defaultChecked. CHECKED
.
checked. .
, radiol
f orml :
document.forml.radiol[0].checked=true;
, false. .
click() false.
, click () Click. .


, JavaScript, . <SELECT>. . :
<SELECT NAME="selectl" SIZE=40>
<OPTION VALUE="choicel" SELECTED>
<OPTION VALUE="choice2">
<OPTION VALUE="choice3">
</SELECT>
<OPTION> . VALUE ,
<OPTION> .
MULTIPLE
. , ,
.
select.
.
name. .
length. .
options. . .
selectedlndex. .
, ,
.

164

IV. Web-

option length, . .
index. .
defaultSelected. SELECTED.
selected. . true
. MULTIPLE
selected .
name. NAME. .
text. , .
Netscape Navigator 3.0 .
select : b l u r ( ) f o c u s ( ) . ,
text.
onBlue, onFocus onChange , .
. ,
.
.

. selectedlndex value. :

ind=document. navform. choice. selectedlndex;


val=document.navform.choice,options[ind].value;
ind .
ind, value
val. "22- .
Web-".


14.1, HTML- ,
. .

14.1.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:

<HTML>
<HEAD>
<> </>
<SCRIPT LANGUAGE="JavaScript">
function display)) {
DispWin=window.open('', 'NewWin', 'toolbar=no,status=no,width=300,
height=200')
message="<UL><LI><B>NAME:
</B>"+document.forml.yourname.value;
DispWin.document.write(message);
message="<LI><B>ADDRESS: </B>"+document.forml.address, value;
DispWin.document.write(message);
message="<LI><B>PHONE: </B>"+document.forml.phone.value+"</UL>";
DispWin.document.write(message);
}

14- .

165

14:
15:
16:
17:
18:

</SCRIPT>
</HEM
<BODY>
<1> </1>
. Display

19:

<FORM name="forml">

20:

<>:</ TYPE="TEXT" LENGTH="20" NAME=" your name ">

21:

<P>

22:
23:
24:

<>:</ TYPE="TEXT" LENGTH="30" NAME="address">


<P>
<B>Ten.:</B><INPUT TYPE="TEXT" LENGTH="15" NAME="phone">

25:
26:
27:
28:

<PxlNPUT TYPE="BUTTON" VALUE="Display" onClick="display();">


</FORM>
</BODY>
</HTML>

HTML
513 display, ,
"13- . ",
.
19 .
JavaScript, .
2026 : yourname, address phone.
25 Display, display.
. 14.1 . , , display.




.
JavaScript, (
).
, ACTION mailto:. 14.2 14.1,
.

14.2.
1:
2:
3:
4:
5:
6:
7:
166

<HTML>
<HEAD>
<1> </1>
</HEAD>
<BODY>
<1> </1>
.
IV. Web-

8:
9:

Submit
<FORM name="forml" action="mailto:user@host.com" enctype="text/plain">

10:
11:
12:

<>:</ TYPE="TEXT" LENGTH="20" NAME="yourname">


<P>
<>:</1! TYPE="TEXT" LENGTH="30" NAME="address">
<P>
<B>Ten.:</BXINPUT TYPE="TEXT" LENGTH="15" NAME="phone">
<P>
<INPUT TYPE="SUBMIT" VALUE="Submit">

13:
14:
15:
16:

17:
18:
19;

</FORM>
</BODY>
</HTML>

, user8host.com . enctype="text/plain", 9.
.

#~ & -* .*

R*to*d

Home

See*

Gukfe

Soculy

^ Locetiore|He-///Ol/JavaScr()(E4)(s/Lisl/H_l Urri
;

j ,^ JJ^jy*^^'j5 Lbofa!- ;


. Display

.:|
T<Jl;JM5-5-5S

NAME:
ADDRESS:
: 555-55-55

. 14.1. , ,

14- .

167



JavaScript . , JavaScript , . , ,
.
. 14.3 , .

14.3.
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:

168

<HTML>
<HEAD>
<1> </1,>
<SCRIPT LANGUAGE="JavaScript">
function validate!) {
if (document.forml.yourname.value.length<l){
alert(", , "};
return false;
}
if (document.forml.address.value.length<3) {
alert(", , ");
return false;
}
if (document.forml.phone.value.length<3) {
alert(", , -");
return false;
}
return true
}
</SCRIPT>
</HEAD>
<BODY>
<1> </1>
.
Submit
<FORM name="forml" action="mailto:user@host.com" enctype="text/plain"
onSubmit="validate();">
<>:</1 TYPE="TEXT" LENGTH="20" NAME=" your name ">
<P>
<B>Aflpec:</B><INPUT TYPE="TEXT" LENGTH="30" NAME="address">
<P>
<B>Ten.:</B><INPUT TYPE="TEXT" LENGTH="15" NAME="phone">
<P>
<INPUT TYPE="SUBMIT" VALUE="Submit">
</FORM>
</BODY>
</HTML>

IV. Web-

validate)),
. length .
, ,
. .
<FORM> 26 onSubmit. validate;). return . .

onChange.
Submit.

. 14.2 . , , .

Reload

:>

Home

,*.

Search

*,'

Location.*"

'

GuKle

Prrt

Security

159
ft

:."Mml

l<want Message Inteinet /Jj Lookup -^j NewbCooi


Submit

'Document: Done

. 14.2.

14- .

169


HTML
JavaScript. form
. .
,
. , .
JavaScript, . .


JavaScript
, ,
JavaScript?
, . Submit
submit. He , CGI . CGI . , .
" "
, , ?
. HTML.
, , .
, ?
. , . , 20 member,
memberfO], member[19]
.. .
JavaScript ?
JavaScript ,
.
.

?
. focus () .
<BODY> onLoad. , .

170

IV. Web-



1. <FORM> ,
?
a) ACTION
b) METHOD
) NAME
2. onSubmit ?
a) <BODY>
b) <FORM>
c) <INPUT>, Submit
3. JavaScript, CGI?
a)
b)
c)

1, ) ACTION
2, ) onSubmit <FORM>
3, b) JavaScript ,
.

, .
validate(), 14.3, ,

. ( focus
.)
14.3
.
@.

14- .

171

15



.
Web- ,
HTML .
, JavaScript ,
, Quake. , ,
JavaScript .
.




172

IV. Web-



Web-. ,
, .
.
.

HTML HTML.
,
Web-.

JavaScript - . (
, , Web-.)
, .
GIF JPEG.
,
.
USEMAP.
15.1 HTML.

15.1.
1:
2:
3:
4:
5:
6:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function update(t) {
document. f orml. textl. value=t;

7:

8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:

</SCRIPT>
</HEAD>
<BODY>
<MAP NAME="mapl">
<AREA SHAPE=RECT COORDS="14,15,151,87"
HREF="javascript:update('');"
onMouseOver=" i window.status='CepBHCHHft '; return true;">
<AREA SHAPE=RECT COORDS="162,16,283,85"
HREF="javascript:update('');"
onMouseOver="window.status='OTflen '; return true;">
<AREA SHAPE=RECT COORDS="294,15,388,87"
HREF="javascript:update('0 ');"
onMouseOver="window.status='0 '; return true;">
<AREA SHAPE=RECT COORDS="13,98,79,178"
HREF="javascript:update('Email');"
onMouseOver="window.status='CBfl!KHTecb '; return true;">
<AREA SHAPE=RECT COORDS="92,97,223,117"
HREF="javascript:update('');"
onMouseOver="window.status='ToBapH '; return true;">
<AREA SHAPE=RECT COORDS="235,98,388,177"
HREF="javascript:update)'');"
onMouseOver="window.status=''; return true;">
<AREA SHAPE=default
HREF="javascript:update(' ' ) " ;
onMouseOver="window.status='yKaxHTe '; return true;">
</MAP>

15- .

27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:

<1> </1>
<HR>

JavaScript.

.
,
.
<HR>
<IMG SRC="imagemap.gif" USEMAP="fmapl">
<HR>
<FORM NAME="forml">
<> :</>
<INPUT TYPE="text" NAME="textl"
VALUE=", , ">
</FORM>
<HR>
</BODY>
</HTMI>


. , , . 15.1. ,
onMouseOver .
_
....-_______
*> * Vfew go Communicate*

'

&~ V ** ' rf .

fletead Home .

Sewcfr

Gu

Pnnt

Security

Stop

UoM*t (Jf NewACooi


JavaScript
. , .

SERVICE I SALES

PRODUCTS

INFO

OUR STAFF

: |6,

'I

4 '

. 15.1. , JavaScript

HTML JavaScript update)).


forml.textl. .
174

IV. Web-


Web- - . , . , (, ) .
Web- , . ,
. ,
Web- . .
,
. , .
Web-.
.
,
.
.
.
JavaScript 1.1, ..
Netscape Navigator 3.0 Internet Explorer 4.0.
.

images
images. , , . .
image document.
image .
border. BORDER <IMG>.
.
complete. .
(true false).
height width. .
. .
hspace vspace. .
.
name. NAME .
lowsrc. LOWSRC. ,
,
.
src. , URL. .

75- .

175

src. ,
lowsrc. .
image , .
onLoad. . (
onLoad image, ,
.)
onAbort. ,
.
onError. , .


, image. , -, .
, .

. , .
image
new. :

image2=new Image();
image2.src="arrowl.gif"
- "11- . ".


, .
, , Web. , . (,
).
onMouseOver,
( ). 15.2 HTML .

15.2.
1:

<HTML>

2:
3:
4:
5:
6:

<HEAD>
<1> </1>
</HEAD>
<BODY>
<1> </1>

176

IV. Web-

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:

<HR>

<>
< HREF="home.html"
onMouseOver="document.images[0].src='homel.gif;"
onMouseOut="document.images[0].src='home.gif';">
<IMG src="home.gif" width=192 height=47 alt="" border="0">

</A>
<BR>
<A HREF="links.html"
onMouseOver="document.images[l].src='linkl.gif';"
onMouseOut="document.images[l].src='link.gif' ;">
<IMG src="links.gif" width=93 height=42 alt=""
border="0">

</A>
<BR>
<A HREF="guest.html"
onMouseOver="document.images[2].src='questl.gif;"
onMouseOut="document.images[2] .src='quest.gif;">
<IMG src="quest.gif" width=195 height=42 alt=""
border="0">
</A>

<BR>
<A HREF="email.html"
onMouseOver="document.images[3].src='emaill.gif;"
onMouseOut="document.images[3 ].src='email.gif;">
<IMG src="email.gif" width=185 height=42 alt=""
border="0">

</A>
</BODY>
</HTML>

. , guest.gif
guestl.gif . . OnMouseOver onMouseOut.
, . . 15.2
.
, .

, , ,
.

15- .

177

Back

'";:.:'

Retoad

Hene

Search

Glide

FHn*

See

3$ *B*meA , Loea^jfilftV//WJ^aScrelExplt/l-t/15_2btr
JtlralantMesMge ^ Intern* 'j Lookup '3 NewbCod ' .

Links
Guest Book
Send Email

Puc. 15.2. JavaScript


, , Web. HTML
. , JavaScript
. ,
.
, GIF . ,
GIF.



. , . ( , , .)
,
. 15.3. , 100x100 , "".
178

IV. Web-

"" mousel.gif-mouse8.gif. , . mouse0.gif.

mouse"! .GIF

rnouseZGIF

mouse3.GIF

mouse4 GIF

mouse5.GIF

mouse6,GIF

mouse7.GIF

mouse8,GIF

mouseO.GIF

. 15.3. ,

HTML
HTML, .
,
. HTML :
<1> JavaScript</Hl>
<HR>
<CENTER>
<IMG src="mouse0.gif" width=100 height=100 alt=" border='
<IMG src="ntouse0.gif" width=100 height=100 alt=" border='
<IMG src="mouse0.gi" width=100 height=100 alt=" border='
<IMG src="mouse0.gif" width=100 height=100 alt=" border='
<IMG src="raouse0.gif" width=100 height=100 alt=" border='
</CENTER>
, mouse0.gif, .. . ,
image[0-4].


:
var cbox=0;
var nbox=l;
var cimage=0;
var niraage=0;
15- .

179

cbox 0-4, , . ""


. nbox
.
cimage (18),
. A nimage ,
.


. next, . setTimeout.
next ,
. :

function nextf) {
cimage+=l;
cimage , . JavaScript:
if (cimage>8) {
cimage=4;

document.images[cbox].src="moused.gif";
cbox=(cbox+l)%5;
nbox=(cbox+l)%5;

cbox 8, nbox .
(%), 4. ,
"" .
cimage 4. ( , 5, 6, 7, 8,
1, 2, 3.)
, :

nimage = cimage - 5;
if (nimage <=0) nimage = 0;
nimage cimage - 5,
. 15.3, ,
1, 2 3 6, 7 8
. , nimage 0.
,
nimage cimage :

document.images[cbox].src="mouse"+cimage+".gif";
document.images[nbox].src="mouse"+nimage+".gif";
window.setTimeout("next();",100);
}

(0,1 ).
.

180

IV. Web-



. 15.3 HTML
. <BODY> onLoad, next .

15.3.
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:

<HTML>
<HEAD>
<1> JavaScript</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var cbox=0;
var nbox=l;
var cimage=0;
var nimage=0;
function preload() {
al = new Image));
al.src = "mousel.gif";
a2 = new Image();
a2.src = "mouse2.gif";
a3 = new Image();
a3.src = "mouse3.gif";
a4 = new Image();
a4.src = "mouse4.gif";
a5 = new Image();
aS.src = "mouse5.gif";
a6 = new Image();
a6.src = "mouse6.gif";
a7 = new Image));
a7.src = "mouse7.gif";
a8 = new Image();
aS.src = "mouse8.gif";
window.setTimeout("next();",500);
}
function next() {
cimage+=l
if (cimage>8) {
cimage=4;
document.images[cbox] .src="mouse0.gif";
cbox=(cbox+l)%5;
nbox=(cbox+l)%5;
}
nimage = cimage - 5;
if (nimage <=0) nimage = 0;
document.images[cbox].src="mouse"+cimage+".gif";
document.images[nbox].src="mouse'4nimage+".gif";
window.setTimeout("next();", 10 0);
}

</SCRIPT>
</HEAD>

15- .

181

45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:

<BODY onLoad="preload();">
<1> JavaScript</Hl>
<HR>
<CENTER>
<IMG src= "mouseO .gif" width=100
<IMG src= "mouseO .gif" width=100
<IMG src= "mouseO .gif" width=100
<IMG src= "mouseO .gif" width=100
<IMG src= "mouseO .gif" width=100
</CENTER>
<HR>
</BODY>
</HTML>

height=100 alt="" border="0">


height=100 alt="" border ="0">
height=100 alt="" border =" 0">
height=100 alt="" border ="0">
height=100 alt="" border ="0">

, HTML .
, .html , mouse0.gifmouse8.gif. (. 15.4).

JavaScript

. 15.4.
. ,
<IMG> 49-53.

182

IV. Web-


, JavaScript .

.
IV
, .


onMouseOver, .
Internet Explorer, Netscape Navigator. ?
,
<IMG>. Internet Explorer. Netscape Navigator
<>. ( Internet Explorer.)
?
. .
.
, .
JavaScript?
. . ,
GIF . , .
JavaScript HTML , . ?
JavaScript <IMG> HIEGHT WIDTH. , , . "21- . JavaScript".


1. ?
a) onMouseOver ondick
b) onMouseOver onMouseUnder
c) onMouseOver onMouseOut
2. JavaScript?
a)
b)
c)
75- .

183

3. JavaScript ?
a) image[2]
b) images[2]
c) images[1]

1, ) onMouseOver
onMouseOut
2, b) JavaScript
3, ) images[l]

HTML .
15.1 , , .
15.2 ,
. MouseDown.

184

IV. Web-

16-


IV. :
Netscape Navigator Internet Explorer.
.
, , , .
, , - ,
JavaScript .
DOM HTML. JavaScript " ",
, .
.



, JavaScript
,

16- .

185


"10- . "
( window document),
HTML. JavaScript
navigator,
.
navigator JavaScript. , .
,
. .
navigator.appCodeName. . ,
Mozilla.
navigator.appName. , Netscape Navigator Microsoft
Internet Explorer.
navigator.appVersion. Netscape. ,
4.0(Win95;I)
navigator.userAgent. ,
Web- Web-.
, Mozilla/4.0(Win95;I)
navigator.language. (
). , . ,
.
navigator.platform. , .
. Winl6, Win32 .
(,
ActiveX Windows).
if. , Web-, ,
Netscape Navigator 4.x:
if (navigator.userAgent.indexOf("Mozilla/4")==-!)
window.location="non_netscape.html";
, navigator
Netscape Navigator, JavaScript. ,
Internet Explorer.


16.1 .
.

16.1.
1:
2:

<HTML>
<HEAD>

3:

<1> </11>

4:
5:

</HEAD>
<BODY>

186

IV. Web-

6:

<1> </1>

7:

<HR>

8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24;

<>
<B>navigator</B>

</>
<UL>
<SCRIPT LANGUAGE="JavaScript">
document.write("<><> :</>" +
navigator.appCodeName);
document.write("<LI><B>HMH :</B>" +
navigator.appName);
document.write("<><> :</>" +
navigator.appVersion);
document.write("<><> :</>" +
navigator.userAgent);
document.write("<LI><B>H3biK:</B>" +
navigator.language);
document.write("<LI><B>miaTij)opMa:</B>" +
navigator.platform);
</SCRIPT>
</UL>
<HR>
</BODY>
</HTML>

HTML.
HTML ( 1320). navigator, .. .
document.write.
, . ,
. Netscape Navigator HTML, . 16.1.


HTML 16.1 Internet Explorer, . . 16.2 HTML Internet Explorer.
, . . ,
, navigator.language Internet Explorer .
, Mozilla.
:
Mozilla/4.(compatible; MSIE 5.5; Windows 98; Win 9x4.90)
? Microsoft Netscape!
Mozilla Microsoft!
, . "" Web-, .
16- .

187


navigator
1'11
Netscape
.4 04 [en] (Wm95,1)
* iioAioMivJ-MoBlla/4 04 [en] (Win95,I)
.1 en

, 16.1. Netscape Navigator

^ D-UavaScnptEt<pl*\List\16_1 W


O6bexrnavigstor

rqiorpxMMbJ'Micrcsoft Internet Explorer


:4 0 (compatible; MSIE 5 5; "Windows 9S; Win 9x4.90)
*;4.0 (compauble, MSIE 5 5, Windows 98, Win 9x4 90)
; undefined
: Win32

. 16.2. Internet Explorer

188

IV. Web-

Netscape, Microsoft, ( Internet Explorer 3.0


Netscape Navigator 3.0). Web-, Netscape,
JavaScript,
Mozilla.
Microsoft Mozilla.
.
, Internet Explorer Netscape, compatible (). Internet Explorer Web-,
.
Web- , Web- . Microsoft " " Netscape.
Internet Explorer
Netscape. Netscape
, a Microsoft .

, , ,
, JavaScript. ,
. , , navigator:
if (navigator.userAgent.indexOf("Mozilla/4")==-!)
window.location="non_netscape.html";
,
Mozilla/4, Netscape Navigator 4.x Internet Explorer 4.x.
. ,
Netscape Navigator 4.0? :
if

(navigator.appName.indexOf("Netscape")==-!)
&& (navigator.appVersion.indexOf("4.0")==-!}
window.location="non_netscape.html";

if navigator.appName,
(Netscape Microsoft). navigator.appVertion. 4.0 Netscape, .
indexOf,
. "6- . ".

. ,
.
, 5.0 .

JavaScript
, , .

16- .


, . . HTML , 16.2.

16.2.
1:
2:
3:
4:

<SCRIPT LANGUAGE="JavaScript">
if (navigator.appName.indexOf("Netscape")==-l)
| !(navigator.appVersion.indexOf("5.0")==-1)
window.alert(" Web- Netscape")
window.location="http://www.netscape.com//";
</SCRIPT>

( Microsoft)
Netscape 5.0,
Web- Netscape.

Web-, .
" " " ". - . .



. , Netscape
Navigator, Internet Explorer,
.
16.3 , HTML. ,
.

16.3.
1:
2:
3:
4:
5:

<SCRIPT LANGUAGE3"JavaScript">
if (navigator.appName.indexOf ("Netscape" )>-!)
& & (navigator.appVersion.indexOf("5")>-1)
window.location="netscape.html";
if (navigator.appName.indexOf("Microsoft")>-l)
S & (navigator.appVersion.indexOf("4")>-1)
window.location="ie.html";
window.location="default.html";
</SCRIPT>

,
: netscape.html Netscape Navigator 5.x 6.x, ie.html
Internet Explorer 4.x 5.x default .

190

IV. Web-

, , , if.
if .
, default.html. , ,
default.html .


, .

HTML.
, , .
. , , .

"19- . DOM".

,
JavaScript
, JavaScript?
, JavaScript
. , .
( 99%) Web- Netscape Navigator Internet Explorer. ,
Lynx, . ,
Netscape Navigator Internet
Explorer .
. , PalmPilot Windows , Internet, . ,
,
.
HTML, , <NOSCRIPT>.
Netscape Navigator 3.0 ;
, JavaScript. , JavaScript, <NOSCRIPT>.
:

<NOSCRIPT>

, JavaScript.
Netscape Navigator < HREF="http://www.netscape.com/">;
< HREF="nojs.html">Be3 </>
</NOSCRIPT>
76- .

191

<NOSCRIPT> ,
Netscape Navigator 2.0 ,
. . 16.4
, , JavaScript,
.

16.4. , JavaScript
1:

2:
3:
4:
5:
6:
7:
8:

<SCRIPT LANGUAGE='JavaScript'>

<! //
......
/*( JavaScript,
HTML)
-->
,
JavaScript. ?
<!-- */ // -->
</SCRIPT>

,
HTML (<!-- -->). JavaScript ,
JavaScript, .
, JavaScript,
. JavaScript:

<SCRIPT LANGUAGE="JavaScript">
window.location="JavaScript.html";
</SCRIPT>
JavaScript, .
. , JavaScript ,
"4- . JavaScript".



, :

Internet Explorer Netscape Navigator 5.0


Netscape 4.x
Internet Explorer 4.x

, 5.0 DOM DHTML. 4.x HTML, .


JavaScript.
browser
. 16.5 .

192

IV. Web-

16.5.
1:
2:
3:
4:
5:
6:
7:
8:
9:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
// 5.0
if (parse!nt(navigator.appVersion)>=5
! ! navigator.appVersion.indexOf("MSIE 5") !=-!) {
browser="DOM";
} else if (navigator.userAgent.indexOf("Mozilla/4")!=-!)

10:

11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
16:
17:
18:

if (navigator. appName. indexOf ("Netscape") !=-!)


browser="NS4";
if (navigator.appVersion.indexOf("MSIE 4") !=-!)
browser="IE4";
} else browser="flpyroft";
</SCRIPT>
</HEAD>
<BODY>
<1> <-1>
<SCRIPT LANGUAGE="JavaScript">
document.write(": " + browser + "<BR>");
</SCRIPT>
</BODY>
</HTML>

( 416) browser
DOM ( 5.0), NS4 ( Netscape 4.x), IE4 (
Internet Explorer 4.x).
browser, .

JavaScript .
IV . JavaScript. , JavaScript.


?
JavaScript?
. navigator , . "20- . ". , Internet Explorer .
navigator ?
?
6- .

193

. . (
, , Web- .)
, .
, , Netscape Microsoft JavaScript?
Windows Opera,
JavaScript. .


1. navigator
Internet Explorer Netscape Navigator?

a) navigator.appCodeNarae
b) navigator.appNarae
c) navigator.appVersion
2. JavaScript?
a) Netscape Navigator
b) Internet Explorer
c) , JavaScript,
3. <NOSCRIPT>?
a)
b)
c)

1, ) navigator. appCodeName (Mozilla)

2, ) JavaScript ,
JavaScript
3, ) <NOSCRIPT>

JavaScript
( 16.1),
Internet Explorer 4.0 Netscape Navigator 4.0 , Internet Explorer 3.0 Netscape Navigator 3.0 .
16.5 Netscape 3.x Internet Explorer 3.x.

194

IV. Web-

JavaScript

17.
18. DOM
19. DOM
20.

17-

! V .

JavaScript, .
,
HTML. Web-.
.




JavaScript

196

V. JavaScript


Web- . HTML . , , .
HTML - , ,
, .
. HTML , ,
. HTML . ,
, , .
. HTML . HTML,
- . . , Netscape Navigator Internet Explorer - , , ..
HTML ,
, Lynx.
-, .
, , HTML. ,
.

, HTML , ,
. ,
.
, Web- HTML. (Cascade Style Sheet CSS ).
CSS HTML ,
. ,
.
HTML,
, , CSS.
. HTML, CSS, , CSS, , . CSS, HTML , , .

CSS
,
. <STYLE>, .
HTML, ,
. <STYLE>
, </STYLE> . CSS:

<STYLE TYPE="text/css">
77- .

197

, ,
. , :
<1 STYLE="color: "> </1>

<STYLE> HTML.

CSS.


, <STYLE>, . , HTML, ,
, . .
. :
<STYLE TYPE="text/css">

HI {color: blue}
</STYLE>
, . ,
, :
<STYLE TYPE="text/css">
1,2,,4,5,6 {color: blue;
font-style: italic;
text-align: center}
</STYLE>
HTML .
<BODY> HTML, . . ,
.


.
HTML. ,
.
letter-spacing. ( Internet
Explorer).
text-decoration. ,
.
vertical-align. , .
text-align. : , ,
.

V. JavaScript

text-transform. . capitalize
, uppercase ,
lowercase .
text-indent. .
line-height. .


, ,
Web-. CSS .
color. .
.
background-color. .
, , Web-.
background-image. GIF
.
background-repeat. . (
Internet Explorer 4.0 ).
background-attachment. . f i x e d , . scroll ( ,
Web-). Internet
Explorer 4.0 .
background-position. (
Internet Explorer).
background.
. .


, Web. .
font-family. , arial helvetica, .
, . CSS
, : serif, san-serif, cursive, fantasy monospace.
font-style. : , , .
font-variant. normal , a small-caps
.
font-weight. . .
font-size. .
font. .
.
77- .

199


, CSS . , , Web-.
margin-top, margin-bottom, margin-left, margin-right. .

.
margin. .
width. , .
height. .
float. . .
clear. .
, CSS ,
. "18- . DOM".


CSS Web-,
. HTML .
.
.
, .
.
17.1 ,
HT^ML.

17.1.
1:
2:
3:
4:
5:
6:
7:
8:
9:

<STYLE>
BODY (color: blue)
P {text-align: center;
margin-left:20%;
margin-right:20*}
HI, H2, H3 {color: red}
UL {color: green;
font-weight: bold}
</STYLE>

.
1 9 <STYLE>.

200

2 .
3, 4 5 .
6 .
7 8 .
V. JavaScript


HTML. .
. 17.1 17.2.
f te ( tfew So

* ; - .*

----- :'-* Rtoad

Homo

,
, -
! 20?<
. .
,

, , 1}?<;!1 ;"'(*<) i tmicKon
-jjii'Mvnr ' ^' ; iivro |.
' aV-' .

w-

iDocument pone"

. 17.1. HTML

17.2. HTML
1:
2:
3:
4:
5:
6:
7:
- 8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

<HTML>
<1> </1>
<STYLE>
BODY {color: blue}
P {text-align: center;
margin-left:20*;
margin-right:201}
HI, H2, H3 {color: red}
UL {color: green;
font-weight: bold}
</STYLE>
</HEAD>
<BODY>
<1> </1>
<> ,
- .
20% .
</>
< STYLE="color:black">
. .

7 7- .

21:
22:

23:
24:
25:
26:
27:
28:
29:

,
.</>

<>
<>
<> , .
,
.
<LI STYLE="color:red">
. .

30:

</>

31:
32:
33:

<> </>
</BODY>
</HTML>


HTML. 10 .
,
.
HTML
, . , . ,
Web-.
HTML, <STYLE> .
<LINK>, :
<LINK REL=STYLESHEET TYPE="text/CSS" HREF="style.css">
style.ess.

JavaScript
DOM
. ,
, JavaScript .
"10- . ",
DOM HTML. HTML .
style.
style ,
. , style.color:
element.style.color="blue"
element . . .
202

V. JavaScript

.
<1> head 1:

<1 ID="headl">3io </1>



GetElementByld:
element.getElementById("headl");
,
:

document. getElementBy Id ("headl"). style. color=" blue";


headl . .


DOM . , .
17.3
<select>, .

17.3.
1:
2:
3s
4:
5!

6:
7:
:
'):

10:
11:
12:
13:
14:
15:
16:
17:
18:
19:

<FORM NAME="forml">
<> :</>
<SELECT name="body" onChange="changebody() ;">
<option value="red"></option>
<option value="blue">CHHra</option>
<option value="green">3eneHnft</option>
<option value="yellow"KenTbm</option>
<option value="black">4epHtw</option>

</SELECT>
<BR>

<> :</>
<SELECT name="heading" onChange="changehead();
<option value="red">KpacHi>m</option>
<option value="blue">CHHM</option>
<option value="green">3eneHbiii</option>
<option value="yellow"KenTbm</option>
<option value="black">4epmw</option>
</SELECT>
</FORM>
,
"14- . ".

, changehead changebody.
.
17.4 , .
17- .

203

17.4.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:

<SCRIPT LANGUAGE="JavaScript">
function changehead(} {
i=document.forml.heading.selectedlndex;
headcolor=document.forml.heading.options[i].value;
document. getElementByld ("headl")-. style. color=headcolor;
}
function changebody() {
i=document.forml.body.selectedlndex;
doccolor=document. f orml. body. options [ i ]. value ;
document.getElementByld("pi").style.color=doccolor;
}
'

</SCRIPT>

26 changehead. , . 5 getElementByld, . changebody 7-11 .


,
. 17.5 .

17.5.
1:

<HTML>

2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function changehead() {
i=document.forml.heading.selectedlndex;
headcolor=document.forml.heading.options[i].value;
document.getElementBy!d("headl") .style.color=headcolor;
}
function changebody() {
i=document. f orml. body. selectedlndex;
doccolor=document. f orml. body. options [ i ]. value;
document.getElementByld("pi").style.color=doccolor;
}

15:
16:
17:

</SCRIPT>
</HEAD>
<BODY>

18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
204

<H1 ID="headl">
</1>
<HR>
< ID="pl">
.

.</>
<FORM NAME="forml">
<> :</>
<SELECT name="body" onChange="changebody();">
<option value="red">KpacHHU</option>
<option value="blue">CHHHH</option>
V. JavaScript

30:

<option value="green">3eneHHft</option>

31:

32:
33:
34:
35:
3 6:
37:

<option value="yellow"KenTbm</option>

<option value="black">4epHUH</option>
</SELECT>
<BR>
<> :</>
<SELECT name="heading" onChange="changehead();">
<option value="red">KpacHbiii</option>

38:
39:
40:
41:
42:
43:
44:
45:

<option
<option
<opti,on
<option
</SELECT>
</FORM>
</BODY>
</HTML>

value="blue">CHHHU</option>
value="green">3eneHbra</option>
value="yellow">e</option>
value="black">4epHbm</option>

, <1> 18 ID
headl. 21 <> pi.
getElementByld 8 13.
. 17.2 . , . ,
.

:.-,. ' -*- - , J _3 ^} J~j


|*1 D \DialekiJkaSJavaSaipl_SE\ListYI

!!.!:'


[ _

il ><

. 77.2,

17- .

205


, Web-. CSS
JavaScript .
DOM.


, <> <1>, ?
.
, .
, .

, ?
CSS
. ,
. ,
.

, ?
, , ,
. ,
. , -
, .
Web-.


1.
(DHTML)?
a)

HTML

<STYLE>

b) <STYLE TYPE="text/css">
c) <STYLE TYPE="text/javascript">
2. HTML
HTML?
a)
b)
c) HTML Web-
3. JavaScript?
a) HTML 4.0
b) DOM
c) CSS 2.0

206

V. JavaScript


1, b) CSS <STYLE TYPE="text/css">
2, ) HTML
3, b) DOM


.
17.5 ,
. 17.5,
,
.
17.5
ChangeColor,
; onChange.

17- .

207

18-

DOM
DOM (
), JavaScript . , .
DOM, Web
. .
DOM
, ,

JavaScript

DOM

208

V. JavaScript

DOM
"10- . "
DOM. window document ..
. DOM,
HTML.
DOM, HTML, 18.1.
( ).

18.1. HTML

4:
5:

<HTML>
<HEAD>
<1> HTML</TITLE>
</HEAD>
<BODY>

<1> </1>

<> </>
</BODY>
</HTML>
HTML . <HTML></HTML> , <BODY></BODY> ..
DOM
.
document. . . 18.1
DOM.

HTML

. 18.1. HTML DOM

18- . DOM

209

DOM .
, .
(ID)
. .
.
. ,
DOM.

DOM (node).
. 18.1 , , .
.
. (ID) .


, JavaScript
. , , (, ). DOM .
. 18.1 document
. html body head, a hi
body.
-. . , hi .
,
.


DOM . ,
, .
. 18.1 hi . body. , body head.


Netscape Navigator 4.0 Web- <LAYER>. <LAYER>
</LAYER>. , . CSS.
DOM HTML. ,
DOM <div>.

V. JavaScript

<DIV> HTML 3.0. HTML . .

<DIV>,
<DIV> STYLE. :

<DIV ID="layerl" STYLE="position:absolute; left:100; top=100">



layerl. , 100 100 . .


STYLE <DIV> :
, .
.
position. , .
.
static. ,
HTML. .
absolute. .
relative. , HTML, static.
left top. . absolute
, relative
, static.
width height. WIDTH HEIGHT HTML.
.
clip. . ,
.
overflow. ,
.
none, clip scroll.
z-index. .
1. , , 2 ..
, "" .
JavaScript .
visibility. . visible (
), hidden inherit. inherit
.
background color. .
layer-background-color. ( ,
).
background-image. , .
layer-background-image. (
, ).
7<5- . DOM

211


,
style.
, .
, <div>.
<DIV ID="layerl" STYLE="position:absolute; l e f t r l O O ; top=100">
<> </>

style. top. , 200 , :

var obj=document.getElementById("layerl");
obj.style.top=200;
document. getElementBylD ,
<div>. 200 .
, :

document . getElementByld ( " layer 1 " ) . style . top=200 ;


.


, DOM , ,
. Internet
Explorer 5.0 Netscape 6.0. .
, DOM
Web-, , .
DOM ( , ).
,
. Netscape
Navigator Internet Explorer 4.0
, DOM, -, HTML .
"16- .
".
, , ,
Internet Explorer, Netscape Navigator 4.0. CSS <div>. ,
, DOM.

<DIV ID="layerl" STYLE="position: absolute; left:100; top=100">


<> </>
.
DOM ( ):
var obj=document.getElementById("layerl") ;
obj. style. top=200;

21 2

V. JavaScript

Internet Explorer 4.0 , document.all. :

var obj=document.all.layer1;
obj.style.top=200;
Netscape 4.0 layers.,
:

var obj=document. layers ["layer 1" ]


obj.top=200;
, DOM HTML . .



Web-. "15- . "
JavaScript .
.
( , ) , DHTML. ,
. 18.2 .

18.2.
1:
2:

3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
.15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
2 5:
26:

<HTML>
<HEAD>

<1> DHTML</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var posl=-95;
var pos2=-95;
var pos3=-95;
var speedl=Math.floor(Math.random()*10)+2;
var speed2=Math. floor (Math, randomf )*10)+2;
var speed3=Math.floor(Math.randomf )*10)+2;
function next)){
posl+=speedl;
pos2+=speed2;
pos3+=speed3;
if (posl>795) posl=-95;
if (pos2>795) pos2=-95;
if (pos3>795) pos3=-95;
document.getElementById("mousel").style.left=posl;
document. getElementBy!d("mouse2").style.left=pos2;
document. getElementBy!d("mouse3").style.left=pos3;
window.setTimeout("next();",10);
}
</SCRIPT>
</HEAD>
<BODY onLoad="next();">
<1> DHTML</H1>

18- . DOM

213

27:
28:
28:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:

<HR>
<DIV ID="raousel" STYLE="position:absolute; left=0;
top=100; width=100; height=100; visibility:show">
<IMG src="mouse5.gif" width=100 height=100 alt="" border="0">
</DIV>
<DIV ID="mouse2" STYLE="position:absolute; left=0;
top=200; width=100; height=100; visibility:show">
<IMG src="mouse5.gif" width=100 height=100 alt="" border="0">
</DIV>
<DIV ID="mouse3" STYLE="position:absolute; left=0;
top=300; width=100; height=100; visibility:show">
<IMG src="mouse5.gif" width=100 height=100 alt="" border="0">
</DIV>
</BODY>
</HTML>

. , ,
DOM, Internet
Explorer 5.0 Netscape Navigator 6.0 . . 18.2
Web- Internet Explorer 5.0.

D \JavaScncitExDb\ListM8_2.htrrJ

DHTML

J
. IS. 2. Internet Explorer 5.0.

214

V. JavaScript


DOM, .
DOM,
, DOM, .


, Web- HTML
()?
document,
.
, DOM, Internet
Explorer 5.0. ?
Internet Explorer 5.0 4.0.
.
DOM , <div>?
, <img>. <div>, .
DOM , Netscape Microsoft
?
, , . DOM
W3C HTML XML,
. ,
.


1. ?
a) <LAYER>
b) <div>
c) <style>
2. ?
a) Left
b) right

c) Irpos
1. Internet Explorer 4.0 , DOM?

a) document
b) layer
c) document.all
18- . DOM

215


1, b) <div> .
2, ) left
3, ) document.all Internet Explorer 4.0
, DOM.

, .
18.2 ,
layers document.all.
18.2 ,
( ,
"" )

216

V. JavaScript

19-
DOM
DOM ,
HTML . DOM .
DOM, . Web-,
DOM. .

DOM
DOM



19- . DOM

DOM
Web- . () JavaScript.
.

DOM, .
W3C http://www.w3.org/TR/DOMLevel-2/.


style, . , .
nodeName. ( ). ,
HTML,
. , BODY, HEAD .
. , tdocument ttext.
nodeType. , .
HTML 1, 3 9 .
nodeValue. , .
nodeValue .
HTML, BODY DIV.


, ,
, .
.
firstChild. .
, hi , .
lastChild. .
childNodes. .
.
previousSibling. ,
.
nextsibling. , .
, , JavaScript,
, , .
.

218

V. JavaScript


document ,
. getElementByld.
DOM . :
qetEle&entById(udeHmu(puKamop). .
getElementByTagName(drac/>Mn/H0p).
. (*).
createTextNode(/wmvn). , .


. .
appendChild(Hoe&/M ).
.
insertBefore(oet>/tt, ).
, .
replaceChild(oeww, ). .
removeChild(c/na;wu). .
hasChildNodesf). : true
, a false .


DOM Web-. .
"17- . ",
visibility, :

object.style.visibility="hidden";//
object.style.visibility="visible";//

. , Internet Explorer 5.0 . JavaScript . :

object.style.display="none";//
object.style.display*"";//
, . 19.1 HTML .

9- . DOM

219

19.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:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function ShowHide(){
var headl=document.getElementById("headl") ;
var head2=document.getElementById("head2") ;
var showheadl=document.forml.headl. checked;
var showhead2=document.forml.head2. checked;
if ( navigator. userAgent.indexOf("Netscape6"
)!=-!){
headl . style .visibility3 ( showheadl ) ? "visible" : "hidden" ;
head2. style. visibility=(showhead2)? "visible": "hidden" ;
}else{
headl . style .display=( showheadl ) ? " " : "none" ;
head2. style. display=(showhead2)?"": "none";
}
}
</SCRIPT>
</HEAD>
<BODY>
<hl ID="headl">3TO </>
<hl ID="head2">3TO </>
<p>C DOM ,
. </>
<FORM NAME="forml">
<INPUT TYPE=" checkbox" name="headl"
checked onClick="ShowHide(};">
<> </><>
<INPUT =" checkbox" name="head2"
checked onClick="ShowHide();">
<> </><>
</FORM>
</BODY>
</HTML>
, DOM, Netscape 6.0 Internet Explorer 5.0 .
.

21-22 headl head2.


2633 , .
. , ( onclick ShowHide).
<SCRIPT> 4-18. 6-7 headl head2 getElementByld. 89 showheadl showhead2 .
, 10-16
. 10 Netscape 6.0,
11-12 .
1415.

220

V. JavaScript

10-11 14-15 . ? :
if.
"7- . ".
. 19.1 . , .


.
& 1&

. 19.1. ,


,
Web-. ,
nodeValue (), .
headl :

var headl=document.getElementById("headl");
headl. firstChild.nodeValue="HoBbiu ";
headl .
f irstChild , ,
nodeValue .
, Web-, . 19.2
HTML.

19- . DOM

221

19.2. Web-
1:
2:
3:
4:
5:
6:
7:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function ChangeTitle() {
var newtitle=document.forml.newtitle.value;
var headl=document.getElementById("headl");

8:

headl.firstChild.nodeValue=newtitle;

9:

10:
11:
12:

</SCRIPT>
</HEAD>
<BODY>

13:

14:
15:
16:
17: .
18:
19:
20:
21:
22;

<hl ="> JavaScript</hl>

<p>C DOM .
<>
<FORM NAME="forml">
<INPUT TYPE="text" NAME="newtitle" SIZE="25">
<INPUT TYPE="button" !=""
onClick="ChangeTitle();">
</FORM>
</BODY>
</HTML>

1822
. ,
ChangeTitle(), 4-10. 6 , . 7 8
.
19.2 19.2. ,
.


DOM Web- . , .
:
var node=document.createTextNode("3TO ");
HTML. -'
appendChild. ,
. .
, pi:
document.getElementByldf "pi") .appendChild(node);
19.3 HTML,
Web-.

222

V. JavaScript

19.3.
1:
2:
3:
4:
5:
6:
7:
8:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
function AddText() {
var sentence=document.forml.sentence.value;
var node=document.createTextNode("" + sentence);
document.getElementByld("pi").appendChild(node);

9:

10:
11:
12:
13:
14:

</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<p ID="pl">C DOM

16:
17:
18:
19:
20:
21:
22;

.</>
<FORM NAME="forml">
<INPUT TYPE="text" NAME="sentence" SIZE="65">
<INPUT TYPE="button" VALUE="" onClick="AddText();">
</FORM>
</BODY>
</HTML>

15:

1416 , .
1720 , , . AddText
410.
6 sentence.
.
DOM. 8
.
. . . 19.3 , Internet Explorer 5.5.


"6- . " Web- .
DOM
.
, ,
. window, status,
. 19.4
HTML .

19- . DOM

223

kUcmioll IMcinct I tptan


DOM .

. 19.2. Web-
3 d - Micitisott tnleinet! xploier


.
. . ..

. 19.3.

224

V. JavaScript

19.4.
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:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
=" . ";
+="0 ,";
msg+=" ";
spacer="...
...";
pos=0;
function ScrollMessage() {
var newtext=msg.substring(pos, msg.length)+
spacer+msg.substring(0,pos);
var td=document.getElementBy!d("scroll");
td.firstChild.nodeValue=newtext;
pos++;
if (pos > msg.length) pos=0;
window.setTimeout("ScrollMessage()",200);
}
</SCRIPT>
</HEAD>
<BODY onLoad="ScrollMessage();">
<!> </>
<>
</>
<TABLE width="90%" border>
<tr>

27:

<td ID="scroll" width="90V>Beryniee coo6u(eHHe</td>

28:
29:
30:
31:

</tr>
</TABLE>
</BODY>
</HTML>

2529 , . <td> 27 scroll .


59 ; ScrollMessage
1018. onLoad.
11-12 newtext. 13
, "" , , 14
.
, 15-16 pos. 17
ScrollMessage . . 19.4 19.4.
. ,
, ..

79- . DOM

225

' ' Qo*a ' gna

Cjpewt '

\Lisl\l 9_4.html



! , ....

...

gj

. 19.4.

DOM. DOM.
DOM Web-. .
JavaScript .
, DOM.
.


ID DOM,
?
, . DOM ID. , . ,
firstChild nextsibling.
, DOM, HTML, <>?
. . , .
226

V. JavaScript

DOM
?
. Web-
. .


1. paral DOM ,
New Text?
a) paral.value="New Text";
b) paral.firstChild.nodeValue="New Text";
c) paral.nodeValue="New Texy";
2. DOM ?
a) body
b) div
c) document
3. DOM headl?
a) document.getElementByld("headl")
b) document.GetElementByld)"headl")
c) document.getElementByID("headl")

1, b) nodeValue,

2, ) document
DOM.

3, ) G , D d.

DOM , .
19.1 .
<>.
19.3 , ,
. appendChild insertBef ore.
19.4 , "" ,
.

7 9- . DOM

227

20


V. JavaScript: , DHTML. .
, HTML
.. JavaScript , HTML .
.
LiveConnect, JavaScript, Java
JavaScript
MIME

,

228

V. JavaScript

LiveConnect
Netscape Navigator 4.0. (, , ), Netscape
,
.
. .
ShockWave Flash Macromedia .
Adobe Acrobat
.
RealPlayer .
Beatnik Headspace .
Web- . Netscape Navigator
.
QuickTime .
LiveAudio MIDI.
RealPlayer, ShockWave Headspace.
Netscape, ,
. LiveAudio .
, , , . ,
(, Windows
Macintosh). , ,
, Netscape Navigator 3.0 .
, . Netscape Navigator 3.0 .

, , Web-
<EMBED>.
, HTML .

MIME
Internet (Multipurpose Internet
Mail Extensions MIME)
Internet. MIME.
MIME: HTML ( text/html), (
text/plain) GIF ( image/gif). Web- MIME,
.
HTML , Web- MIME
. MIME, . , (
).
20- .

229

LiveConnect
,
. LiveConnect. LiveConnect Netscape, JavaScript, Java .
LiveConnect . . Java JavaScript.
LiveConnect Java JavaScript
Java JavaScript.
Web- Netscape:
http://www.netscape.com/docs/raanuals/liveconnect.html


navigator, "10- . " plugins.
, .
, navigator.plugins Netscape Navigator
3.0 .
:
name. ;
filename. ;
description. , ;
mimeTypes. MIME, .
.
.
navigator
mimeTypes. , mimeTypes MIME, .


, ,
, ? JavaScript. ,
, .
20.1
QuickTime ( , QuickTime). , <EMBED>, . .

230

V. JavaScript

20.1.
1:
2:

test=navigator.mimeTypes["video/quicktime"];
if (test)

3:
4:
_5jj

else

document.writeln("<EMBED SRC='quick.mov' HEIGHT=100 WIDTH=100>");


document.writeln("<MG SRC='quick.gif HEIGHT=100 WIDTH=100>");

, Web-, , , .


plugins . 20.2 HTML,
, , .

20.2.
1:

<HTML>

2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

<HEAD>
<1> </1>
</HEAD>
<BODY>
<1> </1>
<HR>

.
navigator.plugins.
<HR>

12:
13:
14:
15:
16:

TABLE BORDER>
<> </>
<> </>
<></>
</TR>

17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:

<SCRIPT LANGUAGE="JavaScript">
for (i=0; i<navigator.plugins.length; i++) {
document, write ("<TRXTD>");
document.write(navigator.plugins[i].name);
document.write)"</TD><TD>");
document .write (navigator. plugins [ i ]. filename);
document.write ("</TDXTD>");
document, write(navigator.pluginsfi].description);
document.write("</TDX/TR>");
}
</SCRIPT>
</TABLE>
</BODY>
</HTML>

1826. 18
. , plugins. ( ).

20- .

231

document.write, 1925,
plugins, . . 20.].


, navigator
. LiveConnect .
embeds, document. , , :

document.embeds[0]
Netscape,
embeds , , Internet Explorer ( 4.0 ).

embed ,
. , LiveAudio play stop, .
.
$!- List of Plug-Ins Netscape

*sl

ttc-

.-*

Ptirit

fit

Security

13
^v Dowrifoad _'_! Chsre>efe

List of Plug-Ins
The following is a 1st of the plug-ins: installed in this copy of Netscape, generated using tilt JavaScript nwigaor.phigins object:
Flag-in Nam*
jLrveConnect-Enabled
:Plug-b (32-bit)

Filename
!C:MNTBRbrETU-IETSCAPE\PE.OGB-AM\plugmsUirpra32.dIl

Description
|LiveConnect-nabled
;P!wg-b

jHeaHspaM Beatrak Player C^^^^^^^^*~^^^ jjfaipace Player Smb for


Stub V ;
{Netscape Cornnumcator

IQuickTmie Plug-b

:C:\rNTERiJFnNETSCAPE\P5.0GBAM\plugms\NPQTW32.DLL

iLive Audio
INPAVB2 Dynamic Link
'Library

jQuickTime PKig-In for


jVftri32v.M,0
'Sound Player for
(Netscape Navigator,
jr. 1.1.1515
JNPAVI32, avipluginDLL!

. 2ft , Netscape Navigator

232

V. JavaScript



JavaScript
. . "" .

http://www.jsworkshop.com.


WAV
13 . ,
. HTML <EMBED>.

. , 13 (
). AUTOSTART=false, .
HIDDEN=true,
. <EMBED> :
<EMBED SRC="CO.wav" HIDDEN=true AUTOSTART=false>
,
. "".



GIF. ,
. 13 whitekey.gif blackkey.gif.
.
.
:
< HREF="t" onClick="playnote(0);">
<IMG border=0 SRC="whitekey.gif" ALIGN=TOP></A>
. onclick, .


playnote () .
note ( 011, ) play. :
function playnote(note) {
document.embeds[note].play();

20- .

233


20.3 HTML,
. ,
13 : 13 <EHBED> .
, .

20.3. HTML,
1:
<HTML>
2:
<HEAD>
3:
<TITLE>Piano</TITLE>
4:
<SCRIPT LANGUAGE="JavaScript">
5:
function playnote(note) {
6:
document.embeds[note].play();
7:
}
8:
</SCRIPT>
9:
</HEAD>
10:
<BODY>
11:
<EMBED SRC="CO.wav" HIDDEN=true AUTOSTART=false>
12:
<EMBED SRC="cs0.wav" HIDDEN=true AUTOSTART=false>
13:
<EMBED SRC="d0.wav" HIDDEN=true AUTOSTART=false>
14:
<EMBED SRC="ds0.wav" HIDDEN=true AUTOSTART=false>
15:
<EMBED SRC="e0.wav" HIDDEN=true AUTOSTART=false>
16:
<EMBED SRC="f0.wav" HIDDEN=true AUTOSTART=false>
17:
<EMBED SRC="fsO.wav" HIDDEN=true AUTOSTART=false>
18:
<EMBED SRC="g0.wav" HIDDEN=true AUTOSTART=false>
19:
<EMBED SRC="gs0.wav" HIDDEN=true AUTOSTART=false>
20:
<EBED SRC="a0.wav" HIDDEN=true AUTOSTART=false>
21:
<EMBED SRC="as0.wav" HIDDEN=true AUTOSTART=false>
22:
<EMBED SRC="b0.wav" HIDDEN=true AUTOSTART=false>
23:
<EMBED SRC="cl.wav" HIDDEN=true AUTOSTART=false>
24:
25:

26:
27:
28:
29:

30:
31:

32:
33:

34:
35:

36:
37:

38:
39:

40:
41:

42:
43:

44:
234

<1> JavaScript</Hl>
<HR>

<> </>
<HR>
< HREF="f" onClick="playnote(0); ">
<IMG border=0 SRC="whitekey.gif" ALIGN=TOPX/A>

<A HREF="t" onClick="playnote(l); ">


<IMG border=0 SRC="blackkey.gif" ALIGN=TOPX/A>

<A HREF="t" onClick="playnote(2);">


<IMG border=0 SRC="whitekey.gif" ALIGN=TOPX/A>

<A HREF="#" onClick="playnote(3); ">


<IMG border=0 SRC="blackkey.gif" ALIGN=TOPX/A>

<A HREF="t" onClick="playnote(4),-">


<IMG border=0 SRC="whitekey.gif" ALIGN=TOPx/A>

<A HREF="f" onClick="playnote(5); ">


<IMG border=0 SRC="whitekey.gif" ALIGN=TOPx/A>

<A HREF="t" onClick="playnote(6); ">


<IMG border=0 SRC="blackkey.gif" ALIGN=TOPx/A>

<A HREF="I" onClick="playnote(7); ">


<IMG border=0 SRC="whitekey.gif" ALIGN=TOPX/A>

<A HREF="f" onClick="playnote(8); ">


V. JavaScript

<IMG border=0 SRC="blackkey.gif 11 ALIGN=TOPX/A>


<A HREF="t" onClick="playnote(9);">
<IMG border=0 SRC="whitekey.gif " ALIGN=TOPX/A>
<A HREF="t" onClick="playnote(10);">
<IMG border=0 SRC="blackkey.gif 11 ALIGN=TOPX/A>
<A HREF="I" onClick="playnote(ll) ,-">
<1MG border=0 SRC="whitekey.gif 11 ALIGN=TOPX/A>
<A HREF="|" onClick="playnote(12) ;">
<IMG border=0 SRC= "whitekey.gif" ALIGN=TOPX/A>
<HR>
</BODY>
</HTML>

46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:

HTML , ( Web-).
. ( , .)
. 20.2 HTML.
, .
*

.<*

1*

Commuracao

fteloaa Home

M*>

Search

Gude

Pint

.Stop.

iiteV/XDI/JevaSciiptE
^InriantMei

"C5 Look* CJ *

JavaScript

mm

. 20.2.

20- .

235


JavaScript, HTML , . ,
.
"", Web-.
. .
, ,
JavaScript.


?
. Navigator . ( )

navigator.plugins.reload.

?
Web- . , Navigator, Web- Netscape.
? .
, QuickTime . . .


1. JavaScript ?
a) Java
b) LiveConnect
c) LiveAudio
2. plugin :

a) document
b) window
c) navigator
3. Netscape Navigator
?
a) LiveConnect
b) LiveAudio
c)

236

V. JavaScript


1, b) LiveConnect JavaScript
2, ) plugins navigator
3, b) LiveAudio Netscape
Navigator

.
20.1 ,
Web- .
"" 20.3 . (
Web-, .)

20- .

VI

JavaScript

21. JavaScript
22. Web-
23.
24. Web

-
JavaScript
! JavaScript.
, , .

. . .

JavaScript

JavaScript

240

VI. JavaScript


. ( ), , .
, .

.


,
. , , .
, , .
.
. , . , , .
. , .
, , .
JavaScript . ,
.
.
var. , , , ,
.
.
.
. ,
.


, ,
. . , .


, , . ,
, , . .
. .

21- JavaScript


, , (==)
(=). ,
.
, , : "=" , "==" . :
if (a=5) alert(" ");
. ,
= 5 5,
5. JavaScript. "==" "=" .


,
. , , .
, , .
"5- . " .


.
.
, window.alert alert.
, (, ) . alert , ,
.
document
. , write document.write.

HTML
, , JavaScript , Web-. HTML,
.
HTML ,
. .
HTML, JavaScript.
HTML .
.

242

VI. JavaScript


, .
.
JavaScript .

JavaScript
,
JavaScript. Netscape Navigator 4.5
, JavaScript.
, Netscape Navigator :
javascript:. JavaScript,
(. 21.1).
, JavaScript JavaScript. ,
.


JavaScript. javascript: .
, Netscape Navigator 4.5
.
.
, .
prefs.js ( ) Netscape.
JavaScript Error:
file: / | /BOORS/ JavaScript/I is t.2-4a. html, line 10:
missing ) after argument list,
seconds = Math.round(seconds;

javascript tjpeiii

Clear Console

Close

Puc. 21.1. JavaScript


21- . JavaScript

243

, .
JavaScript, .
JavaScript , ,
:

users_pref (" javascript. console. open_on_error", true);


Netscape Navigator.
JavaScript.
prefs.js .
Netscape Navigator. .


, JavaScript
. JavaScript .
.
, . , , . , .
,
. document.write.
, , .


Internet Explorer
Microsoft Internet Explorer 4.0
JavaScript. Web- , , HTML-
.

Internet Explorer, Tool () Options ( ). Advanced (). Disable script
debugging (He ) Display a notification
about every script error ( ).
JavaScript , Internet Explorer. ,
Netscape Navigator .
Internet Explorer.


, . , .
.

244

VI. JavaScript

,
. , , . , , JavaScript.
. .
document.write, .

JavaScript

, -.
Netscape
.


JavaScript , Netscape.
Web- Netscape :

http: / /developer. netscape. com/software/ j sdebugg. html


SmartUpdate Netscape
Navigator. Nescape Navigator.
Web-
Netscape. .


.
jsdebugger.html.
Netscape. . ,
.
.
JavaScript , .
, ,
. , HTML, , . Open () . . Web-. ,
. 21.2.
. . Web- Netscape.

21- . JavaScript

245

var cries
'function f l

:-l

11)

document. iorral. hint. value - "No, ouess lower.";


I it. (guess " ) {
window. alett ("Correct ! You guessed it in " + t r i e s
location. re load () ;
0) {

location. re load () ;
/ SCRIPT*
l >>

ODY>

Hl>Guess a Nuntoer</Hl>
HR>

P>I'i t.hlnlfina ot 4 niunbei;


t in less than 10 cries. </P
. NAE*"oi-n)l">
INPUT TYPE-"text" SIIE-25 N

1 nd 100. Try to

B>Gueas!</B>
INPUT TYPE-"text" NAH-"euess" SIZE-"5">
INPUT TYPE-'tBOTTCJf' VALUE-"Cuess' f QnClic

Puc. 2L2. JavaScript, HTML



.
. .
, . , . . , .
, Interrupt (), .
(
) .

.

246

VI. JavaScript


.
, .
,
Edit () Copy to Watch (
). , , .


. Run (), . ,
, , .
.
Control () Step Into ( ).
.
. Step Over ( ).
Netscape.


, JavaScript,
. , .
21.1 " ".
1 100 .
, ,
( ).
, ,
.

21.1. ,
1:
2:
3:
4:
5:
6:
7:

<HTML>
<HEAD>
<> </1>
<SCRIPT LANGUAGE="JavaScript">
var num=Math.random))*100+1;
var tries=0;
function guess() {

9:
10:
11:
12:
13:
14:
15:
16:

tries++;
status=tries+" ";
if (guess<num)
document.forml.hint.value="Eonbme";
if (guess>num)
document. f orml. hint. value=" ";
if (guess==num) {
window.alert("! "+tries+"
");
location.reload();

8:

17:

var guess=document.forml.guessl.value;

21- . JavaScript

247

18:
19:
20:

21:

if (tries==10) {
window.alert(" . .
: "+num);
location.reload();

22:
23:

24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:

</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<HR>
<> 1 100.
10 </>
<FORM NAME="forml">
<INPUT TYPE="text" SIZE=25 NAME="hint" VALUE="Banie ">
<BR>
<> :</>
<INPUT TYPE="text" NAME="guessl" SIZE="5">
<INPUT TYPE="BUTTON" ="" onClick="guess(); ">
</FORM>
</BODY>
</HTML>

.
5
num.
guess, 723, .

if. ,
( ).
, .


, . .
, .
JavaScript :
guess is not a function (guess - )


, guess.
, .
,
:
function quess() {
var quess=document.forml.quessl.value;

248

VI. JavaScript

, . ,
, , . . guess. ,
, .
. guess guessit.
36 .


. . . , . .
, .
.
. .
. 21.3 , .
3

Rebed
* Buokmek*

Home

j*.

Sewch

Gmde

J& Locatai.pile7//1D!/JavaSci!otExpls/List''21_2.hi

twtart Metsage gj Internet _j Look* -^j NwACool


1 100 10
[
? :

. 21.3.

, , , .
10 , . , 10 . , , .
,
:
5:
var num=Math.random))*100+1;
21- . JavaScript

249

Math.random,
01. 100 1.
() 1100.
,
. , Math.floor,
:
var num=Math.floorfMath.randomf)*100)+1;
. . 21.2 .

21.2.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:

20:

<HTML>
<HEAD>
<1> </1>
<SCRIPT LANGUAGE="JavaScript">
var num=Math.floor(Math.random()*100)+1;
var tries=0;
function guessitf) {
var guess=document.forml.guessl.value;
tries**;
status=tries+"nonbiTKa";
if (guess<num)
document.forml.hint.value="";
if (guess>num)
document.forml.hint.value="";
if (guess==num) {
window.alert("! "+tries+" ");
location.reloadf);
}
if (tries==10) {

window.alert(" . . :"+num);

21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:

}
</SCRIPT>
</HEAD>
<BODY>
<1> </1>
<HR>
<> 1 100.
10 </>
<FORM NAME="forml">

32:
33:

<INPUT TYPE="text" SIZE=25 NAME="hint" VALUE="Batue ">


<BR>

34:
35:
36:
37:
38:
39:

<> :</>
<INPUT TYPE="text" NAME="guessl" SIZE="5">
<INPUT TYPE="BUTTON" VALUE="" onClick="guessit();">
</FORM>
</BODY>
</HTML>

250

location.reload();
}

VI. JavaScript


JavaScript. , .
.
.
.


,
HTML?
JavaScript (,
), HTML . . ( ), ( ).

location.reload ?
,
. .

Internet Explorer JavaScript,


Netscape Navigator?

, . , Internet Explorer.
, Netscape, . http://www.jsworkshop.com/.


1. , ?
a)
b)
c)
2. :
a)
b)
c)
3. JavaScript
?
a)
b)
c)

21- . JavaScript

251


1, )
JavaScript
2, )
3, )

.
, . 21.2 .
21.1 . .

VI. JavaScript

22-
Web-
Web-,
.
.
Web- JavaScript, . .
HTML



Web-,

22- . Web-

253

HTML
Web- ( ) , Fictional Software Company (FSC). Web- , - .
FSC . 22.1.
, , . HTML. 22.1.
^Fictional SoHmra Company - Neticape
Fie < View Go

Coj

Beet

vv -s*. isi " ^ G

Reload

Horn

Search

Netscape

Pint

Searty

corri/examplecAschome IVm
..("Bookmark? .$
. location: JHttp /Aww.j;wotUhop
.
, Inslarit Message

FSC

jl WebMai 3 Contact j-jl Peopte [Sji Yetow Pases S-J ..Download <_j Channels

FICTIONAL SOFTWARE COMPANY!


"The Best Software You can Imagine"

Welcome to our web page! Fictional Software Company specializes in creating innovative, user-friendly software applications
with descriptions filled with industry bumvords.
We have a wide range of products (3 of them) to meet the needs of you and your company. Follow the links below for more
information.
* Fictional Spreadsheet 7.0
* ElEZaLWor<l_Er2JSj>r_6j)
* Fictional Database 7 0

Unlike other software companies, our products have absolutely no bugs, and always work perfectly on all computers.
Nevertheless, you may run into problems in rare cases, usually your own fault If this happens, visit our Technical Suppvit
department for helpful information arid tips. You can also view more information about our company or order products with
our friendly OrderFoiTO.
(c)1998 FSC - designed by the FSC staff

[* Do

Puc. 22.1. Web-, HTML

22.1. HTML FSC


1:
<HTML>
2:
<HEAD><TITLE>Fictional Software Company</TITLE></HEAD>
3:
<BODY>
4:
<IMG SRC="fsclogo.gif" alt="Fictional Software Company">
5:
<HR>
6:
Welcome to our page! Fictional Software Company
7:
specializes in creating innovative, user-friendly software
8:
applications with descriptions filled with industry
9:
buzzwords.

254

VI. JavaScript

10:
11:
12:
13:

<P>We have a wide range of products (3 of them) to meet


the needs of you and your company/ Follow the links
below for more information.
<P>

14:

<UL>

15:
16:
17:

<LI><A HREF="spread.html">Fictional Spreadsheet 7.0</A>


<LI><A HREF="word.html">Fictional Word Processor 6.0</A>
<LI><A HREF="data.html">Fictional Database 7.0</A>

18:

</UL>

19:

<P>

20:
21:
22:
23:
24:

Unlike other software companies, our product have


absolutely no bugs, and always work properly on all
computers. Nevertheless, you may run into problem in
rare cases, usually your own fault. If this happens,
visit our <A HREF="support.html">Technical Support</A>

25:

department for helpful information and tips. You can

27:
28:
29:
30:
31:
32;

our company</A> or order products with our friendly


<A HREF="order.html">Order Form</A>
<HR>
<I>(c) 1998 FSC - designed by the FSC staff</I>
</BODY>
</HTML>

26:

also view more information <A HREF="company.html">about

. , ,
.


Web-
. , , .

. , ,
: ,
, System Requirements.
JavaScript ,
.
, , .



.
.
Web-,
. 22- . Web-

255

. : w , s , a d . ,
.
, , :
tech. ;
sales. ;
feat. ;
price. ;
tips. .
, s_feat.html
. HTML .
. Web-.

HTML
, ,
.

. ,
.
HTML . form. , , . ,
, Go.
,
form.
22.2 , . , . ,
HTML .
22.2.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
256

<FORM name="navform">
<SELECT name="program">
<OPTION VALUE="x" SELECTED>Select Product
<OPTION VALUE="w">Fictional Word Processor
DPTION VALUE="s">Fictional Spreadsheet
<OPTION VALUE="d">Fictional Database
</SELECT>
<SELECT name="category">
DPTION VALUE="x" SELECTED>Select a Category
DPTION VALUE="tech">Technical Support
<OPTION VALUE="sales">Sales and availability
<OPTION VALUE="feat">List of Features
VI. JavaScript

13:

DPTION VALUE="price">Pricing Information

14:
15:

<OPTION VALUE="tips">Tips and Techniques


</SELECT>

16:
17:
18:

<INPUT TYPE="button" NAME="go" VALUE="Go to Page">


onClick="Navigate();"
</FORM>


.
. Go .


Go onclick,
Navigate ( ) . .
,
.
22.3 . .

22.3.
1:
2:
3:
4:
5:
6:
7:

function Navigate() {
prod=document.navform. program, selectedlndex;
cat=document.navform.category.selectedlndex;
prodval=document. navform. program. options [ prod].value;
catval=document. navform. category. options [ cat ].value;
if (prodval=="x" | ! catval=="x") return;
window.location=prodval+"_"+catval+".html";

8=

, prod cat, . prodval


catval , .
if .
,
, .
,
, .html.


- , , . , . .
onMouseOver. .
:
22- . Web-

257

<A HREF="order.html"
onMouseOver="window.status='Allow you to order products';return true;"
onMouseOut="window.status='';">
Order form</A>
window, status
. , true.
(URL ).
onMouseOut
.
"10- .
". "12-
. ".
22.4 onMouseOver FSC. . 22.2. Order Form.
ictional Software Company - Netscape
Fie di View So ,mt*cat Heb
TJ.
Back

RekMd

. fij
,-.'
1
- '. fit
Home- ' Seacti Netscape ' P r i n t - S e c u r i t y

.'^instant Message''';.Il,WebM^ ' Contact ' People [&] Yelow Pages jjj Downed

FSC

FICTIONAL SOFTWARE COMPANY!


"The Best Software You can Imagine"

Welcome to our web page I Fictional Software Company specializes in creating innovative, user-fiiendly software applications
with descriptions filled with industry buzzwords.
We have a wide range of products (3 of them) to meet the needs of you and your company. Follow the links below for more
information.
Fictional Spreadsheet 7.0
Fictional Word Processor 6.0
Fictional Database 7 0
Unlike other software companies, our products have absolutely no bugs, and always work perfectly on all computers.
Nevertheless, you may run into problems in rare cases, usually your own fault. If this happens, visit our Technical Support
department for helpful information and tips. You can also view more information about our company or order products with
our friendly Order Fore

(c)l99S FSC - designed by the FSC staff

\ ABows >"ou to otder products

-''

Puc. 22.2. HTML


22.4. JavaScript
2:
3:
4:

258

<UL>
<LI><A HREF="spread.html"
onMouseOver="window.status='Spreadsheet Info'; return true;"
onMouseOut="window.status='';">
VI. JavaScript

5:
6:
7:
8:
9:
10:
11:
12:
13:
14;

Fictional Spreadsheet 7.0</A>


<LI><A HREF="word.html"
onMouseOver="window.status='Word Processor Info'; return true;"
onMouseOut="window.status='';">
Fictional Word Processor 6.0</A>
<LI><A HREF="data.html"
onMouseOver="window.status='Database Info'; return true;"
onMouseOut="window.status='';">
Fictional Database 7.0</A>
</UL>
^^_^__^


Web- .
,
.
"15- . ".



. , .
, , , . . spread.gif, word.gif, data.gif order.gif. , 2.
, spread2.gif.
,
. .


, onMouseOver onMouseOut. 22.5 HTML , .
22.5.
1:
2:
3:
4:
5:
6:
7:

< HREF="spread.html"
onMouseOver="document.images[l].src='spread2.gif;"
onMouseOut="document.images[1].src='spread.gif;">
<IMG BORDER=0 SRC="spread.gif" height=28 width=173></A>
<A HREF="word.html"
onMouseOver="document.images[2].src='word2.gif';"
onMouseOut="document.images[2].src='word.gif';">

8:

<IMG BORDER=0 SRC="word.gif" height=28 width=225></A>

22- . Web-

259

9:
10:
11:
12:
13:
14:
15:
16:

<A HREF="data.html"
onMouseOver="document.images[3].src='data2.gif';"
onMouseOut="document.images[3].src='data.gif;">
<IMG BORDER=0 SRC="data.gif" height=28 width=121></A>
<A HREF="order.html"
onMouseOver="document.images[4].src='order2. g i f ; "
onMouseOut="document.images[4].src='order.gif;">
<IMG BORDER=0 SRC="order.gif" height=28 width=l52></A>

, .
.
,
,
. 15. Web-, , .


, FSC. ,
, .
.
, Web- .
22.6 HTML,
.

22.6. HTML
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
23:
260

<HTML>
<HEAD>
<TITLE>Fictional Software Company</TITLE></HEA0>
<SCRIPT LANGUAGE="JavaScript">
o2=new Image();
o2.src="oreder2.gif"
d2=new Image();
d2.src="data2.gif";
w2=new Image();
w2.src="word2.gif";
s2=new Imagef);
s2.src="spread2.gif";
function Navigate() {
var prod=document.navform.program.selectedlndex;
var cat=document.navform.category.selectedlndex;
var prodval=document.navform.program.optionsfprod].value;
var catval=document.navform.category.options[cat] .value;
if (prodval=="x" ! ! catval=="x") return;
window.location=prodval+"_"+catval+".html";
}
</SCRIPT>
</HEAD>
VI. JavaScript

24:
25:
26:
27:

<BODY>
<IMG SRC="fsclogo.gif" alt="Fictional Software Company">
<HR>
<A HREF="spread.html"

28:
29:

onMouseOver="document.images[l].src='spread2.gif;"
onMouseOut="document.images[l].src='spread.gif;">

30:
31:

<IMG BORDER=0 SRC="spread.gif" height=28 width=173></A>


<A HREF="word.html"

32:
33:
34:
35:
36:
37:
38:
39:

onMouseOver="document.images[2].src='word2.gif;"
onMouseOut="document.images[2],src='word.gif';">
<IMG BORDER=0 SRC="word.gif" height=28 width=225></A>
<A HREF="data.html"
onMouseOver="document.images[3].src='data2.gif';"
onMouseOut="document.images[3],src='data.gif';">
<IMG BORDER=0 SRC="data.gif" height=28 width=121x/A>
<A HREF="order.html"

40:
41:
42:
43:
44:
45:
46:
47:
48:
49:

onMouseOver="document.images[4].src='order2.gif';"
onMouseOut="document.images[4].src='order.gif';">
<IMG BORDER=0 SRC="order.gif" height=28 width=l52></A>
<P>Welcome to our page! Fictional Software Company
specializes in creating innovative, user-friendly software
applications with descriptions filled with industry
buzzwords.
We have a wide range of products
</P>
<UL>

50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:

<LI><A HREF="spread.html"
onMouseOver="window.status='Spreadsheet Info'; return true;"
onMouseOut="window.status='';">
Fictional Spreadsheet 7.0<A>
<LIXA HREF="word.html"
onMouseOver="window.status='Word Processor I n f o ' ; return true;"
onMouseOut="window.status='';">
Fictional Word Processor 6.0<A>
<LIXA HREF="data.html"
onMouseOver="window.status='Database I n f o ' ; return true;"
onMouseOut="window.status='';">
Fictional Database 7.0<A>
</UL>

63:

<P>

64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:

Unlike other software companies, our product have


absolutely no bugs, and always work properly on all
computers. Nevertheless, you may run into problem in
rare cases, usually your own fault. If this happens,
visit our <A HREF="support.html"
onMouseOver="window.status='Technical Support';return true;"
onMouseOut="window.status='';"">
Technical Support</A>
department for helpful information and tips. You can
also view more information <A HREF="company.html"
onMouseOver="window.status='FSC Software Co'; return true;"
onMouseOut="window.status='';">
about our company</A> or order products with our friendly
<A HREF="order.html"

22- . Web-

261

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:

onMouseOver="window.status='Order Products';return true;"


onMouseOut="window.status='';">
Order Form</A>
<FORM name="navforra">
<SELECT narae="program">
<OPTION VALUE="x" SELECTED>Select Product
<OPTION VALUE="w">Fictional Word Processor
<OPTION VALUE="s">Fictional Spreadsheet
<OPTION VALUE="d">Fictional Database
</SELECT>
<SELECT name="category">
<OPTION VALUE="x" SELECTED>Select a Category
<OPTION VALUE="tech">Technical Support
<OPTION VALUE="sales">Sales and availability
<OPTION VALUE="feat">List of Features
<OPTION VALUE="price">Pricing Information
<OPTION VALUE="tech">Tips and Techniques
</SELECT>
<INPHT TYPE="button" NAME="go" VALUE="Go to Page"
onClick="Navigate();">
</FORM>
<HR>
<I>(c) 1998 FSC - designed by the FSC staff</I>
</BODY>
</HTML>

. 22.3 Netscape
Navigator. , . HTML -.

JavaScript, , HTML .
.


Web- ,
?
JavaScript .
HTML.
?
. , CGI. , .
?
. ,
.
262

VI. JavaScript

Fictional Software Company - Netscape


ite dtt View EG orwnurac*!w H[eip '

: . '
f

' >"' '".

Bookmarks

Reload

: : '

Home 'Search

" :

Netscape .. Print .^''Security

S Loc4!ion:|fiie/V/Ci.'BuOi.S/J.bYaSu,pi/i5.:pag-rNml

| Message ,] WebMri gi Contact People !' Yefew P9et

FSC

1 Download >_j Channels

FICTIONAL SOFTWARE COMPANY!


"The Best Software You can Imag!ne"

ISPREADSHEET] WORD PROCESSO3 DATABASE! [ORDER NOW]


Welcome to our web page! Fictional Software Company specializes in creating innovative, user-fncn<Uy software applications
with descriptions filled with industry buzzwords. We have a wide range of products:
* Fictional Spreadsheet 7.0
* Kthc-nal Word Processor 6.0
* Fictional Database 7.0
Unlike other software companies, our products have absolutely no bugs, and always work perfectly on all computers.
Nevertheless, you may run into problems in rare cases, usually your own fault. If this happens, visit our Technical Support
department for helpful information and taps. You can also view more information about our company or order products with
our friendly Order Form.
| Select a Product

3i Selec1 a Category

Go to Page

(c)l998 FSC - desig/Kti by the FSC staff

Puc. 22.3. HTML, Netscape Navigator


1.

document. navf orm. category. selectedlndex?

a)
b)
c)
2.
onMouseOver ?

a) <>
b) <IMG>
) <MOOSE>
3. onMouseOver="window.status='test';"?
a)
b) true
c) onMouseOut
22-0 . Web-

263


1, )
2, )
<IMG>

<>.

Internet

Explorer

3, b) true,
.


HTML, . 22.6:
( 6)
Back () Forward () ( 10)

264

VI. JavaScript

23-

. JavaScript.
, "",
.
.



23- .

265


.
"". , .
, , .


, , . , . ,
52 Web- http://www.jsworkshop.com.
( , , .)
.
640x480 , ,
, 136x106 .
, ,
. JavaScript , 1 13 ( 1,
13, 12, 11 ..). (, s, h d). , llc.gif.
, Web-
Hold (), Deal () Draw ().



. , , ,
.
23.1 .
.
score. , .
100. .
, .
dealt. , .
, .
hand. , ,
.
held. , (
).
deck. , (52 ).

23.1.
1:
2:
3:
4:
5:

266

var score=100;
var dealt=false;
var hand=new Array(6);
var held=new Array(6);
bar deck=new Array(53);

VI. JavaScript

,
. ( 23.2).

23.2.
1:
2:
3:
4:

5:
6:
7:
8:
9:
10:

// Card
function fname() {
return this.num+this.suit+".gif";
}

// Card
function Card(num,suit) {
this.num=nura;
this.suit=suit;
this.fnarae=fname;
I
,

24 , ,
610 Card.

HTML
: HTML, .
23.3 HTML .
HTML.

23.3. HTML
1:
<HTML>
2:

<HEAD>

3:
4:

<TITLE>Draw Poker</TITLE>
</HEAD>

6:
7:
8:

<IMG SRC="title.gif" width=381 height=81>


<HR>
<FORM NAME="forml">

9:
10:

<TABLE>
<TR>

5:

<BODY>

11:
12:
13:
14:
15:
16:
17:
18:
19:

<TD><IMG border=0 src="blank.gif" height=136 width=106>


<TD><IMG border=0 src="blank.gif" height=136 width=106>
<TD><IMG border=0 src="blank.gif" height=136 width=106>
<TD><IMG border=0 src="blank.gif" height=136 width=106>
<TD><IMG border=0 src="blank.gif" height=136 width=106>
<TD></TD>
</TR>
<TR>
<TD> <A HREF="#" onClick="Hold(l) ;">

22:
23:

<IMG border=0 src="hold.gif" height=50 width=106></A>


<TD> <A HREF="t" onClick="Hold(3);">

27:
28:
29:
30:
31:

<TD> <A HREF="t" onClick="Hold(5);">


<IMG border=0 src="hold.gif" height=50 width=106></A>
</TR>
<TR>
<TD> <B>Total<BR>Score:</B>

20:
21:

24:
25:
26:

<IMG border=0 src="hold.gif" height=50 width=106x/A>


<TD> <A HREF="jt" onClick="Hold(2) ;">
<IMG border=0 src="hold.gif" height=50 width=106x/A>
<TD> <A HREF="Jt" onClick="Hold(4); ">
<IMG border=0 src="hold.gif" height=50 width=106x/A>

23- .

267

32: '
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:

<INPUT TYPE="text" SIZE=6 NAME="total" VALUE="100"x/TD>


<TD colspan=2> <B>Current<BS>Hand:</B>
<INPUT TYPE="text" SIZE=20 NAME="message"
VALUE="Press DEAL to begin.">
<TD>
<TD> <A HREF="f" onClick="DealDraw();">
<IMG BORDER=0 SRC="deal.gif" HEIGHT=50 WIDTH=106></A>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>

HTML.
9 HTML,
.
1017 , .
(blank.gif) , .
1829 .
Hold .
3039 .
, Deal.
. 23.1 HTML, .
3 Diaw Poker - Miciojo Internet Exploiei
j... fc

View

Fjvoiites

loots

Hjefe

iUnte ^AluiVisw /SjBURSTI CjCy/SApp ].

Draw Poter

Total
Score: pD

;.-.:

Hand: (Press DEAL to begin.

.
Puc. 23.1. HTML

268

VI. JavaScript


.
, .
HTML.

Draw Deal
Draw Deal ,
DealDraw:

function DealDraw() {
if (deal==true) Draw();
else Deal();
}
( ). , Draw, Deal.


Deal , HTML. .
23.4 Deal,
deck .

23.4.
1:
2:
3:
4:
5:

7:

8:
9:
10:
11:
12:
13:
14:
15:
16:
17:

function Deal( ) {
//
for (i=l; i<14; i++) {
deck[i] = new Card(i,"c");
deck[i+13] = new Card(i,"h"J;
deck[i+26] = new Card(i,"s");
deck[i+39] = new Card(i,"d");
}
//
var n = Math. floor (400 * Math.randomf) + 500);
for (i=l; i<n; i++) {
cardl = Math.floor(52*Math.random() + 1);
card2 = Math.floor(52*Math.random() + 1);
temp = deck[card2] ;
deck[card2] = deck [cardl];
deck[cardl] = temp;
}

.
38 .
, ..
917 . .
( 10) .
( 12, 13) ( 1416).
23- .

269


Deal . 23.5
.

23.5.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
.13:

//
for (1=1; i<6; i++) {
hand[i] = deck[i];
document.iraages[i].src = hand[i].fname();
document.images[i+5].src = "hold.gif";
held[i] = false;
}
dealt = true;
score = score - 1;
document.forml.total.value = score;
document.images[11].src="draw.gif";
Addscoref);
}

.
2 .
3 .
4 .
5 Hold (
).
6 held.
7 .
8, 9 dealt.
10 .
11 Deal Draw.
12 Addscore .
.


, Hold.

23.6
23.6
.

23.6. Hold
1:
//
function Hold(num) {
3:
if ( ! dealt) return;
4:
if ( !held[num]) {
5:
held[num]=true;
6:
document . images [ 5+num] . src= "hold2 . gif " ;
}
7:
8:
else {
270

VI. JavaScript

9:
10:

11:
.12:

held[num]=false;
document.images[5+num].src="hold.gif";

, . 3
, . 3-12
held, Hold .


Draw Draw.
( Hold). 23.7
.

23.7.
1:
2:
3:

//
function Draw() {
var curcard = 6;

4:

for (i=l; i<6; i++) {

5:
6:
7:

if (!held[i]) {
hand[i] = deck[curcard++];
document.images[i].src = hand[i].fname();

8:
9:

}
}

10:
11:

dealt = false;
document.images[11],src="deal.gif";

12:
13:

score += Addscore();
document, forml. total, value = score;

14:

.
3 curcard,
.
, 6.
4-9 held.
,
.
, ,
10 11 dealt false Deal
Draw.
12 13 .
.


Addscore, . .
23- .

271

( ) 1
2
3
4
5
10
25
50
: 100
23.8 .
23.8.
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:

//
function Addscore() {
var straight = false;
var flush = false;
var pairs = 0;
var three = false;
var tally = new Array(14);
//
var nums = new Array(5);
for (i=0; i<5; i++) {
nums[i] = hand[i+l].num;
}
nums.sort(Numsort);
//
if (hand[l].suit == hand[2].suit &s
hand[2].suit == hand[3].suit S&
hand[3].suit == hand[4].suit s&
hand[4].suit == hand[5].suit) flush = true;
// ()
if (nums[0] == nums[l] - 1 SS
nums[l] == nums[2] - 1 &S
nums[2] == nums[3] - 1 S&
nums[3] == mims[4] - 1) straight = true;
// ()
if (nums[0] == 1 && numsfl] == 10 SS nums[2] == 11
SS nums[3] == 12 SS nums[4] == 13)
straight = true;
// , , ,
if (straight SS flush SS nums[4] == 13 SS nums[0] == 1) {
document.forml.message.value="Royal Flush";
return 100;
}
if (straight SS f l u s h ) {
document.forml.message.value="Straight Flush";

35:
36:

37:

if (straight) {

272

return 50;

VI. JavaScript

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:

document, forml. message. value=" Straight";


return 4;

}
if (flush) {
document.forml.message.value="Flush";
return 5;
}
//
for (i=l; i<14; i++) {
tally[i] = 0;
}
for (i=0; i<5; i++) {
tally[nums[i]] += 1;
}
for (i=l; i<14; i++) {
if (tally[i] == 4) {
document.forml.message.value = "Four of a Kind";
return 25;
}
if (tally[i] == 3) three = true;
if (tally[i] == 2) pairs += 1;
}
if (three && pairs == 1) {
document.forml.message.value="Full House";
return 10;
}
if (pairs == 2) {
document.forml.message.value="Two Pair";
return 2;
}
if (three) {
document.forml.message.value="Three of a Kind";
return 3;
}
if (pairs == 1) {
if (tally[l] == 2 \ \ tally[ll]==2
i 1 tally[12] == 2 ] | tally[13]==2) {
document.forml.message.value="Jacks or Better";
return 1;
}
}
document.forml.message.value="No Score";
return 0;
}

.
.
37 .
813 nums,
. .
14-18 .
23- .

19-27 ( ).
1, 13, .
28-32 (10, , , , ).
3344 .
4551 tally.
.
5271 ,
.
, 7278
.
, , ,
79 80 .


23.9 .
, Web-

http://www.jsworkshop.com/.

23.9. ""
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:
274

<HTML>
<HEAD>
<TITXE>Draw Poker</TITLE>
<SCRIPT LANGUAGE="JavaScriptl.1">
var score = 100;
var dealt = false;
var hand = new Array(6);
var held = new Array(6);
var deck = new Array(53);
function DealDraw() {
if (dealt == true) Draw();
else Deal();
}
function Deal() {
//
for (1=1; i<14; 1--) {
deck[i] = new Card(i,"c");
deck[i+13] = new Card(i,"h");
deck[i+26] = new Card(i,"s");
deck[i+39] = new Card(i,"d");
}
//
var n = Math.floor(400 * Math.randomf) + 500);
for (i=l; i<n; i++) {
cardl = Math.floor(52*Math.random)) + 1);
card2 = Math.floor(52*Math.random)) + 1);
temp = deck[card2];
deck[card2] = deck[cardl];
deck[cardl] = temp;
VI. JavaScript

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:

}
//
for (i=l; i<6; i++) {
hand[i] = deck[i]; =
document.images[i].src hand[i].fnamef);
document.images[i+5].src = "hold.gif";
held[i] = false;
}
dealt = true;
score = score - 1;
document.forml.total.value = score;
document.images[11].src="draw.gif";
Addscoref);
}
//
function Hold(num) {
if ("dealt) return;
if (!held[num]) {
held[num]=true;
document. images [ 5+num].src="hold2.gif";
}
else {
held[num]=false;
document.images[5+num].src="hold.gif";
}
}
//
function Draw() {
var curcard = 6;
for (i=l; i<6; i++) {
if (!held[i]) {
hand[i] = deck[curcard++];
document.images[i]-src= hand[i].fname));
}
}
dealt = false;
document.images[ll].src="deal.gif";
score += Addscore();
document, forml. total, value = score;
}
// Card
function fname() {
return this.num + this.suit + ".gif";
}
// Card
function Card(num,suit) {
this.num = num;
this.suit = suit;
this.fname = fname;
}
//
function Numsort(a,b) { return a - b; }

23- .

275

82:
83:
84:
85:
86:

//
function Addscore() {
var straight = false;
var flush = false;
var pairs = 0;

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:

var tally = new Array(14);


//
var nums = new Array(5);
for (i=0; i<5; i++) {
nums[i] = hand[i+l].num;
}
nums.sort(Numsort);
//
if (hand[l].suit == hand[2].suit &&
hand[2].suit == hand[3].suit &&
hand[3].suit == hand[4].suit &S
hand[4].suit == hand[5].suit) flush = true;
// ()
if (nums[0] == nums[l] - 1 S&
nums[l] == nums[2] - 1 &&
nums[2] == nums[3] - 1 &&
nums[3] == nums[4] - 1) straight = true;
// ()
if (nums[0] == 1 && nums[l] == 10 && nums[2] == 11
&& nums[3] == 12 && nums[4] == 13)
straight = true;
// , , ,
if (straight && flush & nums[4] == 13 && nums[0] == 1) {
document.forml.message.value="Royal Flush";
return 100;
}
if (straight && flush) {
document.forml.message.value="Straight Flush";
return 50;
}
if (straight) {
document. forml. mes sage. value= "Straight";
return 4;
}
if (flush) {
document.forml.message.value="Flush";
return 5;
}
//
for (i=l; i<14; i++) {
tally[i] = 0;
}
for (i=0; i<5; i++) {
tally[nums[i]] += 1;
}
for (i=l; i<14;

87:

276

var three = false;

VI. JavaScript

134:
135:
136:
137:
13S:
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:

if (tally[i] == 4) {
document.forml.message.value = "Four of a Kind";
return 25;
}
if (tally[i] == 3) three = true;
if (tally[i] == 2) pairs += 1;
}
if (three && pairs == 1) {
document.forml.message.value="Full House";
return 10;
}
if (pairs == 2) {
document.forml.message.value="Two Pair";
return 2;
}

if (three) {
document.forml.message.value="Three of a Kind";
return 3;
}
if (pairs == 1) {
if (tally[l] == 2 ] | tally[ll]==2
| | tally[12] == 2 | j tally[13]==2) {
document.forml.message.value="Jacks or Better";
return 1;
}
}
document.forml.message.value="No Score";
return 0;
}
</SCRIPT>
</HEAD>
<BODY>
<img src="title.gif" width=381 height=81>
<HR>
<FORM NAME="forml">
<TABLE>
<tr>
<td> <img border=0 src="blank.gif" height=136 width=106>
<td> <img border=0 src="blank.gif" height=136 width=106>
<td> <img border=0 src="blank.gif" height=136 width=106>
<td> <img border=0 src="blank.gif" height=136 width=106>
<td> <img border=0 src="blank.gif" height=136 width=106>
<td> </td>
</tr>
<tr>
<td> <a href="t" onClick="Hold(l);">
<img border=0 src="hold.gif" height=50 width=106></a>
<td> <a href="*" onClick="Hold(2);">
<img border=0 src="hold.gif" height=50 width=106></a>
<td> <a href="t" onClick="Hold(3);">
<img border=0 src="hold.gif" height=50 width=106></a>
<td> <a href="#" onClick="Hold(4);">

23- .

3, ) .
23- .

279

1S6:
1S7:
188:

<img border=0 src="hold.gif" height=50 width=106></a>


<td> <& href="#" onClick="Hold(5) ;">
<img border=0 src="hold.gif" height=50 width=106></a>

, .
,
(, ) (,
).
. <EMBED>
play.

280

VI. JavaScript

24-

Web
JavaScript,
.
JavaScript Web,
.
24 , JavaScript Web,
, JavaScript.
.
JavaScript
JavaScript
XML

24- . Web

JavaScript
JavaScript.
, "
JavaScript". JavaScript Web.
, , , .
JavaScript.
JavaScript,
Web-, .
, .

.

JavaScript.
, .

Web
Web, , .
( , ), .

JavaScript
1.5, ,
JavaScript
, ,
.
, , 2.0.
, Netscape
. 2.0 , .
, JavaScript 2.0
. ,
JavaScript 2.0, ,
, ,
.

DOM
DOM .
DOM . DOM
, , , Netscape Navigator 6.0 Internet Explorer 5.0
.

282

VI. JavaScript

DOM ,
. ,
DOM . , , .

XML
HTML , Web.
SGML (Standart Generalized Markup Language ). HTML , , SGML, Web-.
, Web-. XML (Extensible Markup Language
) SGML,
, HTML. HTML , XML .
XML / , .

, XML .
XML, .
XML , .
?
- XML. XML . , ,
, .
XML DTD (Document Type Definition
). ,
. , .
, , , XML Web. XML Web
HTML. .
,
. ,
, .

XSL
XML . XML . XML XSL (Extensible Stylesheet Language ).
XSL XML, . , ,
, XML. XML HTML XSL.
XSL XML, DTD,
. XSL
W3C.

24- . Web

283


JavaScript ,
, . ,
JavaScript. , .
, JavaScript.
.


HTML (DHTML) Web-.
DOM, W3C, ,
DHTML. Web- .

. , .
,
.
,
.
"
", .
W3C Web, ,
DOM .
. . . ,
, , .

HTML
, W3C.
. , Web-, W3C,
.
, .
, Netscape Navigator 6.0
"" . "" .

,
HTML.
, . ,

284

VI. JavaScript

<>;
.
,
HTML, . HTML.


, . , , .
. .

, HTML
.


.
JavaScript.
, JavaScript . , .
, Web. , ,
( ),
URL ( ).
:
. Back
() Forward (), . , ()
.
,
, .
, , , ,
.
Web-, ,
.
. , ,
. Web-.
. " "
.
Lynx.
Web- http://www.trill-horae.com/lynx.html.

24- . Web

285


Web-,
JavaScript HTML. , , , Web.
. . ,
JavaScript. JavaScript .


HTML,
XML?
XML .
, , XML.

,
Lynx?
Lynx ( ). , Internet
, ,
Lynx .

, - ?
, .
.


1. DOM W3CI

a) DOM 1.5
b) DOM
c) DOM
2. JavaScript?
a)
b)
c) ,
3. ?
a) HTML, JavaScript DOM
b)
c)

286

VI. JavaScript


1, ) DOM
2, ) ,
3, ) , W3C

, JavaScript.

24 - . Web

287


JavaScipt
. , .

( ) JavaScript.
Arman Danesh, Sams Teach Yourself JavaScript in 24 Days. ISBN 1-57521-195-5.
Richard Wagnerl et al., JavaScript Unleashed. ISBN 1-57521-306-0

Web-, JavaScript
Web- JavaScript.
JavaScript.
DevEdge Netscape.
JavaScript.
http: / /www. developer. netscape. com/tech/ javascript/index. html.
JavaScript Netscape

http://www.developer.netscape.com/docs /manuals/js/client/jsref/index.htm.

Web- Website Abstraction


JavaScript, DOM.
http://wsabstract.com/.
288

Web
Web: JavaScript, XML DHTML, HTML.

http://www.webreference.com/.
, , HTML, JavaScript
http://www.htmlcenter.com/.

http://browserwatch.internet.com/.

JavaScript

289



JavaScript
JavaScript ,
. , ,
. , , .
.

HTML

HTML,
. ,
.

HomeSite
HomeSite Allaire
HTML. , HTML.
JavaScript
.
- Web- Allaire'.

http://www.allaire.com/
290

HomeSite TopStyte
Bradsoft .
Web- http://www.bradsoft.com/topstyle/.

FrontPage
Microsoft Front Page WYSIWYG ( ,
!), HTML.
FrontPage 2000 .
FrontPage Microsoft

http://www.microsoft.com/frontpage/

NetObject ScriptBuilder
NetObject ScriptBuilder JavaScript,

. Web-

http://www.netobjects.com/

BBEdit
BBEdit Macintosh, HTML. BBEdit Lite Web- Bare Bones Software'.

http://www.bbedit.com/


. .
TextPad Windows NotePad.
, ,
HTML.

http://www.textpad.com/.

UltratEdit-32 IDM Computer Solutions


Windows,
. http://www.ultraedit.com/.

HTML
Web-, HTML, ,
, HTML. He
HTML .
, HTML
.
CSE HTML Validator AI Internet Solutions. Windows. HTML
HTML. HomeSite, TextPad
HTML. , Pro ( ),
JavaSkript

291

Lite . Web-
http://www.htmlvalidator.com/.
HTML HTML Validation Service W3C. URL HTML.
http://validator.com/.
WDG HTML Validator , ,
HTML HTML. http://htmlhelp.com/tools/validator/.

292



ActiveX , Microsoft
, , Windows. ActiveX Web-.
HTML (Hypertext Markup Language) .
, Web-. JavaScript HTML, HTML.
Java - ,
Sun Microsystems. Java Web-.
JavaScript Java,
.
JavaScript Web-, Java
Netscape. JavaScript .
Navigator , Netscape, JavaScript.
VBScript , Microsoft,
Visual Basic. VBScript Internet Explorer.
XML , W3C, HTML- DTD (Document Type Definition ).
, Java, Web-.
, .
.

, - True
() False ().
, ,
.
. JavaScript
.
, ,
. JavaScript
.
, JavaScript
.
, , .
,
.
JavaScript, .
, , ,
, .
(DOM Document Object Model) ,
JavaScript HTML. W3C, DOM ,
,
Web.
.
,
.
, . , .
, , ,
.
, . .
.
, , .
, .
JavaScript,
.
JavaScript, .
JavaScript,
.
, .

294

w^


JavaScript
JavaScript. ,
JavaScript .


JavaScript.
. .

Array
. ,
. new.
:
students = new ();
, . , :
f i f t h = students[4];

, length,
. .
JavaScript

295

join. .
.
.
reverse. .
sort. .
.
.

String
JavaScript . .
text = " ";
, new:
text = String(" ");
, length, . .
substring. .
toUpperCase. .
toLOwerCase. .
indexOf. .
lastlndexOf. , .
link. .
anchor. .
, HTML.
string.big. <big> HTML 3.0.
string.blink. <blink>
Netscape.
string.bold. <>.
string.fixed. <tt>.
string.fontcolor. ,
<f ontcolor> Netscape.
string.fontsize. <fontsize>
Netscape.
string, italics. <i>.
string.small.
<small> HTML 3.0.
string.strike. <strike>.
string.sub. , <sub>
HTML 3.0.
string.sup. , <sup>
HTML 3.0.

296

Math
Math "" . . Math .
Math.E. ( 2,718).
Math.LN2. ( 0,693).
Math.LNlO. ( 2,302).
Math.LOG2E. ( 1,442).
Math.LOGlOE. ( 0,434).
Math.PI.

( 3,14159).
Math.SQRTl_2. 0,5 ( 0,707).
Math.SQRT2. 2 ( 2,7178).
Math . ,

Math.acos. . .
Math.asin. . .
Math.atan. . .
Math.cos. .
Math.sin. .
Math.tan. .


Math.exp. ( ),
.
Math. log. .
Math.max. .
Math.min. .

Math.abs. .
Math.ceil. .
Math.floor.
Math.pow. .
Math.round. .
Math.sqrt. .


Math.random. 0-1.
JavaScript

297

Date
Date JavaScript ,
. ,
. JavaScript .
setDate. .
setMonth. . 0 11.
setYear. . setFullYear .
" 2000".
setTime. ( ) , 1 1970
.
setHours, setMinutes setSeconds. , .
getDate. ( ).
getMonth. .
getYear. .
getTime. ( ) , 1
1970 .
getHours, getMinutes getSeconds. ,
.
getTimeZoneOffset.
( ).
toGMTString.
.
toLocatString.
.
Date.parse. ,
( "June 20, 2003" 1
1970 ).
Date.UTC. ( )
.

DOM
DOM , , . ( 10) . 17-19.

Window
window . ,
window. .
self. ,
JavaScript.

298

top. , .
parent. , .
, parent.
frames .
, parent.
parent.frames[0].

(

)
parent.docframe.
window .
location. URL , .
document. HTML, .
history. , ,
.

Location
location URL ,
. ,
URL.
location.protocol. ( ).
location,hostname. .
location.port. .
location.host. .
location.pathname. .
location.hash. , .
location.target. TARGET ,
.
location.query. .
location.href. URL.

History
history , , . .
history.back. .
history.foward. .
history.go. .

Document
document , HTML.
.
document.forms. .
, . document.regform.
.
JavaScript

299

document.links. , .
document.archors. .
document.images. .
document.applets. Java .

Navigator
navigator .
appCodeName. , Mazzila.
appName. .
appVersion. .
userAgent. ,
Web-.

Mozilla/4.5(Win95;I).
pluglns.
.
mimeType. , MIME.


. 11 .


.
new. .
this. .
.
with. . ,
, .
, .
:

function Name(first, last) {


this.first = first;
this.last = last;
}
new:
Fred new Name ("Fred", "Smith");


:
Fred.middle = "Clarence";
, . 300

( ) prototype. :

Name.prototype.title = "Citiaen";
. , num 10.

string, prototype, num = 10;

JavaScript
JavaScript.

. . :

//
/* */
.
.

break for while.

continue for while.

for
for , ,
, .
i 19:

for (i=l; i<10; 1++;) {}

for...in
.
Scores.
:

for (x in Scores) {}

no JavaScript

301


JavaScript HTML.
( return). :
function (nl, n2) {
result = nl + n2;
return result;

if.. .else
. (
if), , ; ,
, else. 10:

if (a>10) {
document, write (" ") ;
}

else {
document. write (" ");
}
. ?
, , : , , :
document. write( (a>10)? " " : " ");
7.

return
, . return , - .

var
. var, .
, :

var students = 30;


JavaScript ,
var :
. students = 30;
var . . , JavaScript , .
6.

302

while
while , ,
. ,
:
while (document.forml.textl.value !="go") {}

JavaScript
JavaScript.
.

eval
, . JavaScript:
= eval("add(x,y);");
eval , .

parse!nt
.
, NaN.

parseFloat
.
, NaN.

Java5cript

303

Mac, 11; 12
Microsoft FrontPage 2000, 12
MIME, 101; 212

ActiveX, 1 1 ; 12
Adobe Acrobat, 28, 212
ASCII, 12

Beatnik, 212

Netscape Navigator, 10; 98; 195


Notepad, 12; 16

CGI, 12; 26
CSS, 180
, 87

Perl, 12

Q
.

DHTML, 266
DOM, 96; 185; 192; 264

QuickTime, 25; 28; 212

R
RealAudio, 28
RealPlayer, 212

ECMA, 10

F
Forth, 76

H
HomeSite, 12
HTML, 7

1
Internet Explorer, 10; 98; 195; 226

J
Java, 1 1
JavaScript Console, 18
JScript, 10
L.

Live Audio, 212


LiveConnect, 28; 2 13
LiveScript, 8

304

s
SGML, 265
ShockWave, 25; 28; 2 12

TextPad, 12

Unix, 11; 12

V
VBScript, 12
Visual Basic, 12

w
W3C, 98; 201; 266
Web-, 264
WWW, 6

, 183

XML, 265
XSL, 265
, 26
, 30
, 25; 161; 196
, 101
, 11
, 41
, 87; 142

, 29; 61
,78
, 10
, 170
JavaScript, 264
, 68

JavaScript, 10
, 28
, 185

, 90
, 43
, 58
JavaScript, 8; 22
, 216

, 130
,91

, 216
Web-, 15
, 35; 110
, 45
, 14
, 42
, 181

, 76
, 67
, 18

, 89
, 45; 224

Web-, 99
, 47
, 133

, 25
, 186
, 158
, 57

, 109
, 121
Web-, 8
HTML, 8
, 193

JavaScript, 8
, 130
, 133

, 182
, 25; 159
, 47
, 12
, 7
, 230

JavaScript, 7
, 101

, 180
, 156
, 145 .
, 103
, 19; 37
, 7
, 70
JavaScript, 18; 225
, 108
, 192
, 29

, 68
, 45; 224

305


, 59; 136
, 35; 87; 202
, 145

, 136
, 28
, 237
HTML, 50
, 110
, 13
, 76

, 45
Web-, 100; 132
, 35; 115; 116; 241
, 12
, 34; 87; 108
, 97; 185
, 88
, 239

, 193
,180
, 142
, 41

Web-, 16
, 130
, 225; 229
JavaScript, 227

, 148

, 202
, 143; 149

, 121
, 143

, 224
, 223

, 41
, 76
, 146
, 14; 44; 45

306

, 103
, 214
JavaScript , 10; 172,
195
, 57
, 133

, 58
, 59
, 35
, 100
, 181
, 159
, 24
, 49
, 228
, 79
, 47; 55; 90

, 26
, 151, 229
, 71
, 213
, 79
, 110

, 60
, 156
, 14
Web-, 9
, 266
, 228
, 147; 237
, 195
HTML, 16
, 57; 116
, 193

, 27; 99; 102; 169


, 34; 97
, 183
, 147
, 147
, 158
, 194
, 117
, 144
, 146
, 182


, 143
, 182
, 201
, 201
, 156
, 202
,25
, 34
, 35; 116
, 143
, 120
, 118
, 266

, 134
, 59
, 129
, 116
, 87
, 193
, 55
, 183
, 109
, 133
, 226
, 61

, 14
, 49; 111
, 68
, 93
, 101
, 23; 226

, 55; 87
, 60
, 55

DOM, 192
, 180
DOM, 97

,180
, 144
, 144
, 12
, 16

, 223
, 48
MIME, 212
, 145
, 93

Web-, 23

Web-, 98
, 89
, 158
, 28
, 96
, 213
, 24; 98; 129
, 58
, 116
, 180
, 23
, 135
, 78
, 182
, 60; 80
, 108
, 193
, 76
, 67
, 18

, 146
, 25; 142
, 91
, 34; 41

, 75

, 193; 201
, 11
, 143

, 7

307

JavaScript 24 , 2-

..
..
..
..

.. , . . ,
. .

"".
101509, , . , . 43, . 1.
. . 090230 23.06.99
.
29.03.2001. 70x100/16.
Times. .
. . . 18,7. .-. . 15,7.
5000 . 371.

,

.
197110, -, ., 15.


Adobe Photoshop 6
24



Photoshop 6. ,
, ; ,
.
,
,
.

'-
,
.
,

Photoshop 6. ,
.
,
.
, ,

.
24
,

Photoshop 6.
.

.

^^:.


CGI-
24

CGI.
, CGI-,
Web-
Web-,
, Web-
,

Web- .


.
CGI Web- .
.

SAMS

JavaScript "

, :

Web-



,

Internet Explorer
Netscape Navigator

Web-

Internet


Web-

: Web-
:

24

JavaScript.


JavaScript


Starling
Technologies,

Internet.
Web-,
Laura Lemay's Web Workshop: JavaScript,

Novell

Microsoft
ISBN

5-8459-0159-6
1029

SAMS

www.williamspublishing.com
www.samspublishing.com

9"785845"90159011

Оценить