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

. .

- 100 %: HTML, CSS, JavaScript, PHP,


CMS, AJAX,
100 %

.
.
.
.
. , .
.

32.988.02-018
004.72
. .
25 - 100 %: HTML, CSS, JavaScript, PHP, CMS, AJAX, .
.: , 2010. 512 .: . ( 100%).
ISBN 978-5-49807-826-7
, -
- . -
, -, HTML, JavaScript, PHP,
AJAX Perl, MySQL, -
(CMS) Joomla! Drupal.
- , -
. ,
-,
, . , -
-, .

. -
.

, , , -
. , ,
-
, .

ISBN 978-5-49807-826-7 , 2010

, 194044, -, . ., 29.
005-93, 2; 95 3005 .
11.06.10. 70100/16. . . . 45,15. 3000. 0000.
CtP . . . .
197110, -, ., 15.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1. HTML CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2. JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

3. Apache, Perl MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

4.
(CMS) Joomla! Drupal . . . . . . . . 315

5. PHP6 . . . . . . 364

6. - PHP . . . . . . . . . . . . . . . . . . . . . . . . . 397

7. AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427

8. . . . . . . . . . . . . . . . . . . . . 451

9. . . . . . . . . . . . . . . . . . . . 469

10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1. HTML CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
HTML- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
<!DOCTYPE> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
<HTML> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
<HEAD> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
<TITLE> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
<META> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
<STYLE> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
<LINK> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
<SCRIPT> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
<BASE> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
<BODY> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
. . . . . . . . . . . . 58


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
. . . . . . . . . . . . . . . . . . . . . . . . . . 69
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
. . . . . . . . . . . . . . . . . . . . . . . . . 83
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
<FORM> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140


2. JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
- HTML- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

3. Apache, Perl MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262


Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Perl Apache . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274


Perl . . . . . . 278
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
. .
. . . . . . . . . . . . . . 290
SQL-: , .
, . . . . . . . . . . . . . . . . . . . . . . . . . 298
: , .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
MySQL Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
. . . . . . . . . . . . . . . . . . . . . . . . . . 307
SQL Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

4.
(CMS) Joomla! Drupal . . . . . . . . . 315
CMS Joomla! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
CMS Drupal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

5. PHP6 . . . . . . 364
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369


PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
. . . . . . . . . . . . . . . . . . . . . . . . . . 378
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

6. - PHP . . . . . . . . . . . . . . . . . . . . . . . . . 397
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
MySQL . . . . . . . . . . . . . . . . . . 410
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
cookie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420


. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426

7. AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
- AJAX . . . . . . . . . . . . . . . . . . . . . . 432
XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450

8. . . . . . . . . . . . . . . . . . . . 451
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Web Link Validator . . . . . . . . . . . . . . . . . . . . . . . . . . 453
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468

9. . . . . . . . . . . . . . . . . . . 469
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480

10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512

, ,
-.
, ,
, .
,
.
- : -
-
HTML- .
HTML,
JavaScript PHP,
CSS, .
, .
, ,
.

1 HTML CSS,
HTML, , -
-. CSS, -
.

2 -
HTML JavaScript,
, .

3 --
Apache, Perl MySQL. -
, Apache,
MySQL Perl MySQL
Apache SQL. , --
,
. - , -
.

4
( CMS).
, -
( , -). -
11

CMS Drupal Joomla!, -


, .

5 PHP, --
. :
, , , , .

6 , 5,
-, ,
MySQL, Cookie.

7 AJAX, -


. AJAX --
, -,
, .
, AJAX
PHP, MySQL.

8 -. ,
, ,
.
. -
. -
, .

9 -
, . -

.

10 ,
-. -
,
.
, .

-c, -, -
, IT- -
- .
,
, -
.

;
,
(, ,
, , , , ..);
, ,
.


, -
,
. ,
,
.


. -
, .

-
, .


, , -
.


,
.
.
13

,
.


,
AlexanderZhadaev@sigmaplus.mcdir.ru -
www.sigmaplus.mcdir.ru (
, ).


,
dgurski@minsk.piter.com ( , ).

( ) -
http://www.piter.com/download.

http://www.piter.com
.
1

HTML CSS
HTML
HTML-

CSS
CSS
CSS

HTML 15

, HTML -
-.
HTML-, CSS.

HTML
(HTML
HiperText Markup Language). , , , -
HTML-,
.

HTML- , -
. .

HTML . -
, .
- .

<>. -
, : </>.
, .
. -
, , -
.

: -
, .

<P>, -
: <P> </P>, -
, . <IMG>,
.

, , -
. , -
, .
16 1. HTML CSS


,
.
, . -
,
.

, ,
. , ALIGN
<P>.

<P align="left"> </P>


<P align="right"> </P>

, , . -
.

HTML, -

. , HTML-
, .

HTML-

. .

<!DOCTYPE>
HTML-.
.

1.1 <!DOCTYPE>.
.

1.1. <DOCTYPE>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://


www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
HTML- 17

HTML-.
, ,
<!DOCTYPE>.

html , HTML.
PUBLIC , -
HTML.
"-//W3C//DTD XHTML 1.0 Transitional//EN" ,
, .
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
URL-, , -
. -
. ,
, , . -
HTML.

,
.

<HTML>
<HTML>, -
. ,
<HTML> </HTML>, HTML
.

1.2 <HTML>.

1.2. <html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!-- -->
</html>

<HTML> ,
.

<HTML> :

xmlns xml-,
xml-;
18 1. HTML CSS

lang ;
xml:lang ;
title .

1.3 <HTML> .

1.3. <HTML>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" title=" " lang="ru"
xml:lang="ru">
<!-- -->
</html>

.1.1 -
<HTML>.

.1.1 ,
,
.
. -
.

,
. . 1.1.
<HTML>

<HEAD>
<HEAD> ,
, ,
, .

<HEAD> </HEAD>. -
, . ,
<HEAD>, : ,
, ,
.

, <HEAD>,
.1.1.

.1.1 .
.
HTML- 19

1.1. , <head>


<title> ,
<meta>
<script>
<link>
<style>
<base>
<basefont>
<bgsound>

<HEAD> , -
, ,
.

1.4 <HEAD>.

1.4. <HEAD>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!-- -->
</head>
<!-- -->
</html>

, <HEAD>.
.1.1,
, .

, .

<TITLE>
<TITLE> , -
. </TITLE>.
, ,
.
20 1. HTML CSS

( ,
), . ,
-
, <TITLE>.
, ,
. ,
.


:
, , .
, -
: ,
. , -
.

-
. -
. ,
(\ / : * ? " < > |), -
.

-
. ,
, .

1.5 <TITLE>.

1.5. <TITLE>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> </title>
</head>
<!-- -->
</html>

.1.2 1.5: -
.

, , -
<HEAD>.
HTML- 21

. 1.2.

<META>
<META> .
,
.

<HEAD> <META>, -
.

<META>.

CONTENT HTTP-EQUIV NAME. -


, .

HTTP-EQUIV ,
, , -
.

.1.2 HTTP-EQUIV.

1.2. HTTP-EQUIV


Content-Type .

Expires . ,
,
Pragma ,


22 1. HTML CSS

1.2 ()


Refresh
,
Content-Language , lang html
Content-Script-Type ,
Content-Style-Type

1.6 ,
HTTP-EQUIV.

1.6. HTTP-EQUIV
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" title=" " lang="ru"
xml:lang="ru">
<head>
<title> META</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"
/>
<meta http-equiv="refresh" content="10; URL=http://www.test.ru" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="Sun, Oct 2010 10:09:00 GMT+3" />
</head>
</html>

, HTTP-EQUIV -
, CONTENT.

Content-Type, ,
. ,
.

Refresh ,
.

. , 1.6 www.test.ru
10 .
HTML- 23


, -
, ,
.

Content -
(.1.3).

1.3. CONTENT HTTP-EQUIV

http-equiv content
Content-Type ISO-8859-1 Latin-1
Windows-1251 (Windows)
KOI8-r (8-)
cp866 (DOS)
Windows-1252 (Windows)
Windows-1250 (Windows)
Expires Sun, Oct 2010 10:09:00
GMT+3 [RFC850]
Pragma no-cache , ,

,

Refresh ( )

( ), URL

,

Content-Language de
el
en
en-GB ,
en-US ,
en-cockney ,
es
fr
it
i-navajo
ja
he


24 1. HTML CSS

1.3 ()

http-equiv content
Content-Language nl
ru
pt
zh
Content-Script-Type text/javascript JavaScript
text/perlscript PerlScript
text/tcl TCL
text/vbscript VBScript
Content-Style-Type text/css CSS

.1.3 CONTENT,
. Content-Type,
,
.

NAME, HTTP-EQUIV, -
, ,
.
, .

.1.4 NAME.

1.4. NAME


Keyword , .

Description
Author
Document-State
Resource-Type . ,
, Document,

Revisit ( )
Robots
Subject
URL (,
,
, )
HTML- 25

.1.4,
. , :
, <META>.

, <META>, -
.
, ,
.


, -
.
- , -
-
.
META , ,
. .

1.7 <META>
.

1.7. <META>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" title=" " lang="ru"
xml:lang="ru">
<head>
<title> META</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="Sun, 10 Oct 2010 10:09:00 GMT+3" />
<meta name="author" content=" " />
<meta name="description" content=" <meta>
" />
<meta name="document-state" content="Dynamic" />
<meta name="keywords" content=", , , " lang="ru" />
<meta name="keywords" content="tags, meta, index, search" lang="en" />
<meta name="Resource-Type" content="Document" />
<meta name="Revisit" content="2" />
<meta name="Robots" content="noindex,follow" />
26 1. HTML CSS

<meta name="URL" content="http://www.test.ru" />


</head>
</html>


, -
, . -
. ,
: ,
. 200250, -
keyword, .
.
,
, -
. , -
, , , -
, .
, -
, -
. , -
, .

Robots .
1.7 ,
, -
.

.1.5 ,
.

1.5. content Robots


Index
Noindex
Follow
Nofollow
All ,

None ,

URL,
www.test.ru.
HTML- 27

, <META> : .
, ,
, .

<STYLE>
, .
.

, , ,
,
<STYLE>.

(CSS) , HTML-
. ,
, HTML- .
, -
, , , HTML-,
.

<STYLE> CSS.
, TYPE -
MIME-: text/css.

- , CLASS
,
.

,
.

. -
, .
,
.

,
MEDIA.

MEDIA :

print ;
screen ;
all .
28 1. HTML CSS

CCS 1.8.

1.8.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<style type="text/css" media="screen" >
p.style {
color:#CC0000;
background:#9999CC;
word-spacing:20px;
}
.style2 {
color:#66FFFF;
background:#990000;
word-spacing:10px;
}
</style>
<style type="text/css" media="print" >
p.style {
color:#000000;
background:#FFFFFF;
word-spacing:20px;
}
.style2 {
color:#000000;
background:#FFFFFF;
word-spacing:10px;
}
</style>
<title> </title>
</head>
<body>
<p class="style">
style
HTML- 29

</p>
<p class="style2">
style2
</p>
<table border="1" >
<tr>
<td class="style2">
style2
</td>
</tr>
</table>
</body>
</html>

. style <P>,
. style2
. 1.8 style2
.

1.8 .1.3.

. 1.3.

, -
.

:
STYLE ( ). CSS
.
30 1. HTML CSS

1.9
STYLE.
1.9. STYLE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> </title>
</head>
<body>
<p style="color:#CC0000; background:#9999CC; word-spacing:20px;">
style="color:#CC0000; background:#9999CC;
word-spacing:20px;"
</p>
<p style="color:#66FFFF; background:#990000; word-spacing:10px;">
style="color:#66FFFF; background:#990000;
word-spacing:10px;"
</p>
<table border="1" >
<tr>
<td style="color:#66FFFF; background:#990000; word-spacing:10px;">
style="color:#66FFFF; background:#990000;
word-spacing:10px;"
</td>
</tr>
</table>
</body>
</html>

, , -
STYLE.

.1.4 1.9.

.1.3 1.4 , -
,
.
HTML- 31

. 1.4. STYLE

:
CSS. , -
<STYLE>, .

.
<STYLE> ( -
1.10). : @import
URL(" ");.

1.10.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
@import URL("test.css");
</style>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"
/>
<title> </title>
</head>
</html>

,
test.css. , @import -
. .
32 1. HTML CSS

.
.

<LINK>
<LINK>
. .
, . -
.
, <LINK> .

HREF. ,
. .

TYPE. , -
.
text/css.

REL REV. -
, -
.
, .

1.11 <LINK>.

1.11. <LINK>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="test.css" rel="stylesheet" type="text/css" />
<link href="copyrihgt.html" rel="copyright" />
<link href="help.html" rev="help" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> LINK</title>
</head>
</html>

1.11 <LINK>
, ,
HTML- 33

, -
.

.1.6 REL.
, , , -
.

1.6. REL


Top
Contents
Index , -

Glossary
Copyright
Next
Previous
Search
Help , ( )

, <LINK> -
, .
, , -
.

<SCRIPT>
<SCRIPT> . -
,
, .
, <SCRIPT>.

.
TYPE LANGUAGE. MIME- , ,
.
, . -
TYPE, LANGUAGE .

<SCRIPT> -
SRC.
34 1. HTML CSS

. ,
.

<SCRIPT> DEFER.

.

1.12 HTML-.

1.12. <SCRIPT>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script defer="defer" language="javascript" type="text/javascript">
<!-- -->
</script>
<script language="javascript" type="text/javascript" src="test.js">
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> SCRIPT</title>
</head>
</html>

, ,
, -
.

, -
. HTML
. -
.

<BASE>
<BASE> , , -
.
( ,
).
HTML- 35


,
. , C:\Test\test.jpg -
, , http://www.test.ru/mytests/test.html
, . -
, . ,
, C:\Test\MyTests\test.html,
C:\Test\test.jpg, ..\test.jpg,
.. .

<BASE> HREF. -
, -
.

TARGET. ,
, .
.

TARGET :

_top ;

_blank ;

_self ;

_parent -.

<BASE> .

1.13 <BASE>.

1.13. <BASE>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://www.test.ru/" target="_blank" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> BASE</title>
</head>
</html>

1.13
http://www.test.ru/. ,
36 1. HTML CSS

../IMG/test.jpg, http://www.
test.ru/IMG/test.jpg. ,
.

, <HEAD>.
.

<BODY>
<BODY> .
. , -
, <BODY>,
.

<BODY> ,
,
: , ..

<BODY>, .

, ( ,
). , -
.

<BODY>, , :

alink ;

vlink ;

link .

hex- . -
,
( ). ,
hex-.

1.14 .

1.14.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
HTML- 37

<head>
<base href="http://www.test.ru/" target="_blank" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> BODY</title>
</head>
<body alink="#00FF00" vlink="red" link="#330000">
</body>
</html>


, .
-
#.
.

. -
.
blue, red, black ..

<BODY> -
. , .

. -
BGCOLOR, . -
BACKGROUND,
. ,
. , -
.
, .

. . BGPROPERTIES
, .
Fixed. , -
, .
.
,
.

1.15 <BODY>, -
.
38 1. HTML CSS

1.15.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://www.test.ru/" target="_blank" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> BODY</title>
</head>
<body background="test.jpg" bgcolor="#0033CC" bgproperties="fixed">
</body>
</html>

1.15 test.jpg ,
, .

,
.

<BODY>, , :

bottommargin
;
leftmargin -
;
topmargin -
.

1.16 , -
<BODY>.
1.16.
<!DOCTYPE html PUBLIC "//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://www.test.ru/" target="_blank" />
<meta http-equiv="Content-Type" content="text/html; charset=windows1251" />
39

<title> BODY</title>
</head>
<body topmargin="10" leftmargin="20" bottommargin="10">
</body>
</html>
10, 20.

<BODY> , .
TEXT . ,
.

SCROLL , -
. Yes No, , ,
. , -
, , , -

.

<BODY>. ,
, .

, , -
. .

. -
. ,
.

<!-- -->. , -
, .

HTML-,
.


, ,
<BODY>. , : ,
40 1. HTML CSS

, .
HTML :
,
, , . , -
.

, -
. ,
.


, .
HTML ,
. -
,
.

HTML .
, .

<H1>, <H2>, <H3>, <H4>, <H5> <H6>.


.
, .

-
ALIGN.

ALIGN :

left ;

right ;

center ;

justify ( ).

TITLE, -
( , -
).

1.17
.
41

1.17.
<html>
<head>
<title> </title>
</head>
<body>
<h1 align="center"> 1 </h1>
<h2 align="justify"> 2 </h2>
<h3 align="left"> 3 </h3>
<h4 align="right"> 4 </h4>
<h5> 5 </h5>
<h6 title=" 6 "> 6 </h6>
</body>
</html>

.1.5 1.17.

.1.5 -
. ,
-
,
,
-
.



( -
).

-
, -
, CSS.
<H16>
STYLE CLASS, .

,
,
. . 1.5.
42 1. HTML CSS


,
. HTML
.

HTML <P>,
. , ,
: , , -
<P>.


. HTML.

<P> , , ALIGN.
.

ALIGN .

center . -
, .
,
;
left .
, . -
, ;
right .
, . -
. -
;
justify .
,
. :
.

, ,
.
TITLE, .

1.18 -
.
43

1.18.
<html>
<head>
<title></title>
</head>
<body>
<p align="center" title=", "> -
, </p>
<p align="right" title=", "> </p>
<p align="left" title=", "> -
, </p>
<p align="justify" title=", "> -
, .
.</p>
</body>
</html>

.1.6
1.18.
.

-
-
. <P> -
STYLE CLASS.


. . 1.6.

, ,
, ? HTML
, .
,
-
.

<BR>.
, <BR />,
.
44 1. HTML CSS

1.19 .

1.19.
<html>
<head>
<title> </title>
</head>
<body>
,<br />
.<br />
</body>
</html>

.1.7 -
1.19.

.1.7 , -
<BR>
,
<P>.

<BR>. . 1.7.
,
, (
, ALIGN).
CLEAR.

CLEAR :

all ;

left , -
;
right , -
;
none .

, , <BR>, -
.
45

, ,
,
. <NOBR>,
. , , -
. -
.


, <NOBR> <WBR>,
.

1.20 <NOBR> <WBR>.

1.20.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"
/>
<title> </title>
</head>
<body>
<nobr> ,
, <wbr> .</nobr>
</body>
</html>

.1.8 1.20.

. 1.8.
46 1. HTML CSS

.1.8,
, .


, ,
.

, HTML -
.


. -
( ),
..

HTML , -
:

,
. , -
, .
.

HTML <UL>. -
, <UL>.
<LI>.

<UL> TYPE, .

TYPE :

circle , ;

square ;

disc .
47

, , -
.

1.21
.
1.21.
<html
<head>
<title></title>
<body>
<ul type="circle">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul type="square" >
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul type="disc" >
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>

.1.9 -
1.21.


<LI>
. 1.9.
.
48 1. HTML CSS

1.22
.
1.22.
<html>
<head>
<title></title>
<body>
<ul>
<li type="circle"></li>
<li type="circle"></li>
<li type="square"></li>
<li type="circle"></li>
<li type="disc"></li>
</ul>
</body>
</html>

.1.10
1.22.

,

. HTML

<LI> . <UL>
, ,
<BR> .
. 1.10.
1.23 -

.
1.23.
<html>
<head>
<title></title>
<body>
<ul>
<img src="marker.jpg" /><br />
49

<img src="marker.jpg" /><br />


<img src="marker.jpg" /><br />
</ul>
</body>
</html>

.1.11 -
1.23.


,
. 1.11.
.


. ,
? , . -
,
.

, ,
, -
.

<OL>,
. .

<OL> TYPE, ,
.

TYPE :

A ;

a ;

I ;

i ;

1 .

<OL> START, , -
.
50 1. HTML CSS

1.24
.

1.24.
<html>
<head>
<title></title>
<body>
<ol type="1" start="6">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ol>
<ol type="A">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ol>
<ol type="a">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ol>
<ol type="I">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
51

</ol>
<ol type="i">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ol>
</body>
</html>

.1.12 1.24 .

. 1.12.

,
6.
52 1. HTML CSS

<LI>
. , <LI>
TYPE. ,
VALUE , .

1.25 -
.
1.25.
<html>
<head>
<title></title>
<body>
<ol type="1" >
<li type="1" value="10"> </li>
<li> </li>
<li value="1"> </li>
<li> </li>
<li type="I"> </li>
<li type="I"> </li>
<li> </li>
</ol>
</body>
</html>

.1.13 -
1.25.

.1.13,
, -
-
.

,
, , .
-
. 1.13.
.
53

, -
, .

.
: ,
.
,
, , .

<DL> -,
.
, STYLE CLASS,
.

- <DL>, <DT>
<DD>.

<DT> , .
.

<DD> <DT>.
. ,
, .

1.26 .

1.26.
<html>
<head>
<title></title>
<body>
<dl>
<dt></dt>
<dd> </dd>
<dt></dt>
<dd> </dd>
</dl>
</body>
</html>
54 1. HTML CSS

.1.14 -
1.26.

.1.14 -
,
-
.

-
. -
.


. 1.14.

. ,
. , .

HTML .
, ,
, -
.

1.27 .
1.27.
<html>
<head>
<title></title>
<body>
<ol>
<li>

<ul>
<li></li>
<li></li>
</ul>
</li>
<li>

55

<ul>
<li> </li>
<li> </li>
</ul>
</li>
<li> </li>
</ol>
</body>
</html>

. 1.15 ,
. . 1.15.

, -
.

. -
, , .

.
, , .
,
.

: .
. -
.


, .
, , -
.

URL- ,
.
56 1. HTML CSS

HTML <A>, .
, -
. , , -
, -
. HTML , -
, , .
, .

<A> </A> ,
<A> HREF. -
, . -
, , ,
.

1.28 HTML- -
.

1.28.
<html>
<head>
<title></title>
<body>
<a href="aboutme.html"> </a><br />
<a href="myfoto.jpg"> </a>
</body>
</html>

.1.16 .

, , ,
.
, -
, . . 1.16.


, HTML-
. ,
. ,
.
57

, , -
. NAME <A>. -
<A>.
,
.

NAME . ,

.

.
, , URL-
: #met1, met1 .
,
.

1.29 .

1.29.
<html>
<head>
<title></title>
<body>
<a name="met2"> 2</a><br />
<a href="#met1"> 1</a><br />
<a href="#met2"> 2</a><br />
<a name="met1"> 1</a>
</body>
</html>

.1.17 ,
.

, -
,
, , .

,
, <A> -
. . 1.17.
58 1. HTML CSS



<A>
, .

<A> .

TARGET. ,
, .

TARGET :

_blank ;

_parent -;

_self ;

_top .

, ,
, , ,
. , , -
. ,
, .

TITLE,
. , -
,
. .

1.30
.

1.30.
<html>
<head>
<title></title>
<body>
<a href="aboutme.html" target="_blank" title=" ,
"> </a>
</body>
</html>
59

.1.18
.

-
,
.

, , -
, -
. ,
. 1.18.
. , ,
,
.

- <A>.

1.31 -.

1.31. -
<html>
<head>
<title></title>
<body>
<a href="mypetfoto.html" target="_
blank" title=" ,
"><img
src="mypetfotomini.jpg" /></a>
</body>
</html>

.1.19 ,
-.

,
,
, .


. ,
, -
, . 1.19. -
60 1. HTML CSS

. , -
.

. , .


? , -
. , , ,
.
, HTML .

.
: . -
.

, -
, . , .
,
. ,
, -
.

,
, . ,
,
, , .

.
,
, .

. -
.


, ,
-
.
.
61

,
,
, , .

<ABBR>

<ABBR> TITLE.
.
, -
TITLE.

<abbr title="- "></abbr>

<ACRONYM>

<ACRONYM> , .


, , ..

TITLE .

<acronym></acronym>

<CITE>

<CITE> , .
.

<cite> </cite>

<CODE>

<CODE> , , ,
, . -
.

<code> func(int a, char b);</code>


62 1. HTML CSS

<DEL>

<DEL> .
. : CITE, URL-
, , DATETIME,
--T::TZD.

TZD . . -
Z, , -
( , UTC Coordinated
Universal Time, ). +.
., (+) ()
UTC. .

<del cite="whydel.html" datetime="2007-10-06T10:11:45+3.00">


</del>

<DFN>

<DFN> . ,
. -
.

<dfn></dfn>-

<EM>

<EM> .
.

<em></em>

<INS>

<INS> , ,
. : CITE, URL--
, , DATETIME,
--T::TZD
(TZD ). .
63

<ins cite="whyadd.html" datetime="2007-10-06T10:11:45+3.00"> -


</ins>

<KBD>

<KBD> , .
.

<kbd></kbd>

<Q>

<Q> ,
. , -
.

: <q> </q>

<SAMP>

<SAMP> ,
. -
.

<samp></samp>

<STRONG>

<STRONG> . -
.

<strong> </strong>

<VAR>

<VAR> . -
.
64 1. HTML CSS

<var>X</var>

1.32 -
.

1.32.
<html>
<head>
<title> </title>
<body>
<abbr title="- "></abbr><br />
<acronym></acronym><br />
<cite> </cite><br />
<code>func(int a, char b);</code><br />
<del cite="whydel.html" datetime="2007-10-06T10:11:45+3.00">
</del><br />
<dfn></dfn>-<br />
<em></em><br />
<ins cite="whyadd.html" datetime="2007-10-06T10:11:45+3.00"> -
</ins><br />
<kbd></kbd><br />
: <q> </q><br />
<samp></samp></br>
<strong> </
strong> <br />
<var>X</var><br />
</body>
</html>

.1.20 -
1.32.

.1.20 , -

. ,
.
- . 1.20.
65

, ,
.


,
.

<B>

<B> .

:
<b> </b>

<I>

<I> .

:
<i></i>

<TT>

<TT> .

:
<tt> </tt>

<U>

<U> .

:
<u></u>

<S>

<S> .

:
<s></s>
66 1. HTML CSS

<STRIKE>

<STRIKE> .

:
<strike> </strike>

<BIG>

<BIG>
.


HTML (1 7).
3.

:
<big> <big> </big></big>

<SMALL>

<SMALL> -
. -
.

:
<small></small>

<SUB>

<SUB> ,
. -
.

:
<sub></sub>

<SUP>

<SUP> ,
.
.
67

<sup></sup>

<SPAN>

<SPAN>
. -
.

<span style="background-color:#00FFFF"> </span>

1.33
.

1.33.
<html>
<head>
<title> </title>
<body>
<b> </b><br />
<i></i><br />
<tt> </tt><br />
<u></u><br />
<s></s><br />
<strike> </strike><br />
<big> <big> </big></big><br />
<small></small><br />
<sub></sub> <br />
<sup></sup> <br />
<span style="background-color:#00FFFF"> </span>
</body>
</html>

.1.21 1.33.

, ,
.
68 1. HTML CSS

. 1.21.

, -
. ,
.

.1.7 -
, .

1.7.


B STRONG
I EM, DFN, VAR, CITE
TT CODE, SAMP, KBD
U INS
S, STRIKE DEL
BIG
SMALL
SUB
SUP

,
, .


. , -
.
69


, , -
. -
, .

, .

<FONT>

<FONT> . -
,
.

<FONT> , ,
.

FACE, .
, -
. -
, -
FACE.

SIZE.
(, 2 6). 3.
. +,
, ,
, . -
, .

COLOR. -
, , #RRGGBB. HTML-
.

1.34
<FONT>.

1.34. <FONT>
<html>
<head>
<title> FONT</title>
<body>
70 1. HTML CSS

<font color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif" size="+2">


+2
</font><br />
<font color="#FF00FF" face="Verdana, Arial, Helvetica, sans-serif" size="-4">
-4
</font><br />
</body>
</html>

.1.22
1.34.

1.34 -
. -

, -
.
,
sans-serif.
-
, - . 1.22. <FONT>
-
.

, . -
, , -
.

<DIV>

<DIV> -
. ,
<DIV> STYLE, -
CLASS.

HTML :
ALIGN
TITLE.

1.35
<DIV>.
71

1.35. <DIV>
<html>
<head>
<title> DIV</title>
<body>
<div style="cursor:crosshair" align="center">

,
-
.
</div>
</body>
</html>

.1.23 -
1.35.
. 1.23. <DIV>
<PRE>

, . , -
?

<PRE> ,
.


HTML .

. <PRE> -
.
.

1.36 <PRE>.

1.36. <PRE>
<html>
<head>
<title> PRE</title>
<body>
<pre>
72 1. HTML CSS






</pre>
</body>
</html>

.1.24 , , - . 1.24.
<PRE>.
<PRE>

<BLOCKQUOTE>

, .
.

<BLOCKQUOTE>
. , .
.

1.37
<BLOCKQUOTE>.

1.37.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> BLOCKQUOTE</title>
<body>
<blockquote>

.
</blockquote>
</body>
</html>

.1.25 ,
<BLOCKQUOTE> .
. 1.25. <BLOCKQUOTE>
73

, ,
HTML , .


HTML .
. , <I> <B>, -
, . -
: , , .

1.38
.

1.38.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title> </title>
<body>
<del><b><i> </b></i></del><br />
<ins><b><i> </i></b></ins>
</body>
</html>

-
,
, .
, .


,
. ,
-.

HTML : ,
, -,
74 1. HTML CSS

.
HTML-: , , , ,
, . -
.


,
(.1.26). .

.
.
, .

, .

, .

. 1.26.


. -
-
. ,
.1.27, -
, .


,
. -
<table>
</table>: . 1.27.
75

<body>
<table>
</table>
</body>

<table>.


. -
, .
<tr> </tr> . -
<td> </td>,
, () :

<body>
<table>
<tr><td> </td><td> </td></tr>
<tr><td> </td><td> </td></tr>
</table>
</body>

<TH> , -
. <TH>.
, <TH> </TH>
.

HTML-, -
,
(1.39).

1.39. HTML-,
<html>
<head>
<title> HTML-</title>
<head>
<body>
<table>
<caption> </caption>
76 1. HTML CSS

<tr><th> 1</th><th>
2</th><th> 3</th></tr>
<tr><td> 2x1 </td><td>
2x2 </td><td> 2x3 </td></tr>
<tr><td> 3x1 </td><td>
3x2 </td><td> 3x3 </td></tr>
</table>
</body>
</html>

.1.28 ,
.

. 1.28. HTML-

. -
border <table>.
. border , -
. bordercolor -
, .
.

<table>

<table border="4" bordercolor="#000000">

( -
) -
-.
- -
, -

.
, , -
-
, . .1.29
, -
Internet
. 1.29.
Explorer. Internet Explorer
77

.1.29 ,
. cellspacing
cellpadding <table>. cellspacing -
( ), cellpadding
.

1.40 ,
10, .
1.40. HTML-

<html>
<head>
<title> HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="10">
<caption> </caption>
<tr><th> 1</th><th> 2</th><th> 3</th></tr>
<tr><td> 2x1 </td><td> 2x2 </td><td> 2x3 </td></tr>
<tr><td> 3x1 </td><td> 3x2 </td><td> 3x3 </td></tr>
</table>
</body>
</html>

.1.30
.

-
frame, -

rules. frame -
:

Above -
;
Below -
;
. 1.30.
Box Border
;
78 1. HTML CSS

Hsides ;
Lhs ;
Rhs ;
Void ;
Vsides .

Frame rules HTML,


. rules :

All ;
Cols ;
Groups -
;
None ;
Rows .

1.41 frame rules.

1.41. HTML- -

<html>
<head>
<title> HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="10"
frame= Hsides rules= Cols>
<caption> </caption>
<tr><th></th><th> </th></tr>
<tr><td>. </td><td> </td></tr>
<tr><td>. </td><td> </td></tr>
<tr><td>. </td><td> </td></tr>
<tr><td>. </td><td> </td></tr>
<tr><td>. </td><td> </td></tr>
<tr><td>. </td><td> </td></tr>
</table>
</body>
</html>
79

.1.31 ,
.

, -

,
frame rules.


width
<table>. -
(width="250"), -
(width="80%"). ,
600, , -
-
.

-
, .

height.

. . 1.31. HTML-

.
-
-
.


,
.

.1.32 1.33 ,
.

80% , -
50% .
100. ,
400.
80 1. HTML CSS

. 1.32. 80%

. 1.33. 300
81

1.42 1.43 .

1.42. HTML- 80%


<html>
<head>
<title> HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="10"
width="80%">
<caption> 80%</caption>
<tr><th height="100" width="50%"> 1</th>
<th> 2</th><th> 3</th></tr>
<tr><td> 2x1 </td><td> 2x2 </td><td> 2x3 </td></tr>
<tr><td> 3x1 </td><td> 3x2 </td><td> 3x3 </td></tr>
</table>
</body>
</html>

1.43. HTML- 300


<html>
<head>
<title> HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="10"
width="300" height="300">
<caption> 300 </caption>
<tr><th> 1</th><th> 2</th><th> 3</th></tr>
<tr><td> 2x1 </td><td> 2x2 </td><td> 2x3 </td></tr>
<tr><td> 3x1 </td><td> 3x2 </td><td> 3x3 </td></tr>
</table>
</body>
</html>
82 1. HTML CSS


HTML4 ( ,
) . -
.

<colgroup> <col>.
<colgroup> ,
. , -
, , . <col>
,
, . ,
.

<colgroup> <col> span=n, -


, n- .
<table>
<col span=2 style="color:red">
<tr><td> <td></tr>
<tr><td> <td></tr>
<tr><td> <td></tr>
</table>

<thead>, <tbody> <tfoot>. -


. -
<thead>.
.
, ,
<tbody>. <tfoot>
, .
.
:
<Thead>
<tr><th> </th><th> </th><th> </th></tr>
</Thead>
</Tbody>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<Tbody>
83

, , -
, , -
( ). ,
.

1. .
2. .


<table>,
<tr>, <th> <td> align valign.

align
:

<table align = left/right/center> -


/ ;
<tr align = left/right/center>
/ ;
<th align = left/right/center> -
/ (
);
<td align = left/right/center/char>
/
( ).

, , ,
. char
.

valign
:

<table valign = bottom/middle/top> -


// ( );
<tr valign = bottom/middle/top>
//;
<th valign bottom/middle/top> -
//;
84 1. HTML CSS

<td valign = bottom/middle/top>


//.

1.44
.

1.44. -

<html>
<head>
<title> HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="0"
width="400" height="150" align=center>
<caption> </caption>
<tr><th> </th><th></th><th></th><th> </th> </tr>
<tr valign=bottom align=center>
<td> </td><td>028</td><td>190 </td><td>12,2 </td></tr>
<tr valign=bottom align=center>
<td> </td><td>058</td><td>120 </td><td>4,6 </td></tr>
<tr valign=bottom align=center>
<td></td><td>986</td><td>100 </td><td>2,3 </td></tr>
</table>
</body>
</html>

.1.34 ,

.



-
, -

. 1.34.

85

. HTML colspan rowspan.


colspan ,
, rowspan .

.1.35 .

. 1.35.

, -
. ,
. 1.45.

1.45.
<html>
<head>
<title>HTML-</title>
<head>
<body>
<table border="4" bordercolor="#000000" cellspacing="0" cellpadding="5" >
<tr align=center><th colspan=3>
</th></tr>
<tr align=center><td rowspan=2> </td>
<td> 22</td><td> 23</td></tr>
<tr align=center> <td> 32</td><td> 33</td></tr>
<tr align=center><td rowspan=2> </td>
<td> 42</td><td> 43</td></tr>
86 1. HTML CSS

<tr align=center> <td> 52</td><td> 53</td></tr>


</table>
</body>
</html>


HTML . bgcolor
, , , ,
, .

<td bgcolor="#000000">, -
<td></td>, , .1.36.

. 1.36. bgcolor

background
, :

<td background="img/fon.gif">

,
, .
87


,
(.1.37).

. 1.37. HTML-

colspan .

, ,
<table> ,
.


. .1.38 ,
www.ya.ru.

-. -

.
, .
,
, .

HTML-
: , , .. -
,
.
88 1. HTML CSS

. 1.38.


, HTML-
<IMG>. .


-
. : ,
. -
, .

HTML- <IMG>.
SRC, -
.

<IMG SRC="image.jpg">
89


, , -
(http://www.mypage.ru/IMG/myfoto.jpg),
, , -
(IMG/myfoto.jpg). -
, , ../.
DOC, IMG, -
: ../IMG/myfoto.jpg.


,
-
. , -
, -
<IMG>.


WIDTH HEIGHT. -
(
%).

,

, . -

, .1.39.

1.46
(
.1.39).

1.46.
<html>
<head>
<title> </title>
</head>
. 1.39.
<body>
90 1. HTML CSS

<br />
<img src="image.jpg" width="60" />
<br />
<img src="image.jpg" width="50%" />
( )<br />
<img src="image.jpg" width="50" height="150" />
</body>
</html>

1.46 , -
, -
, ,
.

, ,
, . -
.


, -
. , -
.

, -
.


<IMG> ALIGN.
, -
.

ALIGN ,
, .
.

left ;

right .
91

top
;
texttop
;
middle ;
absmiddle ;
baseline bottom
;
absbottom -
.


, . -
, .
.
, , .

1.47 -
.

1.47.
<html>
<head>
<title> </title>
</head>
<body>
<img src="image.jpg" width="70" align="top"/> -
<br />
<img src="image.jpg" width="70" align="absbottom"/> -
<br />
<img src="image.jpg" width="70" align="bottom"/>
<br />
<img src="image.jpg" width="70" align="middle"/> -
<br /> </body>
</html>
.1.40 1.47.
.
92 1. HTML CSS

. 1.40.

.
1.48.

1.48.
<html>
<head>
<title> </title>
</head>
<body>
<img src="image.jpg" width="100" align="right" />
, .
, .
, .
: , .
, .
, .
, , . </html>
93

.1.41 1.48.
, .

. 1.41.

.
-
.

, HSPACE VSPACE
<IMG>.
.


. -
BORDER, .

1.49 (border) (vspace,


hspace) 10,
50.

1.49.
<html>
<head>
<title> </title>
94 1. HTML CSS

</head>
<body>
<img src="image.jpg" width="100" align="right" vspace="10" hspace="10"
border="20"/> , .
, -
. ,
. : , -
. ,
. ,
. , , .
</body>
</html>

.1.42 , -
, , .

. 1.42.


, , ,
,
. ,
. , -
, ?
95

ALT. ,
-
. , , -
, .

1.50 .

1.50.
<html>
<head>
<title> </title>
</head>
<body>
<img src="image.jpg" width="100" align="right" vspace="50" hspace="50"
alt=" "/>
</body>
</html>

.1.43 1.50 ,
.

. 1.43.

.1.44 , ,
.
96 1. HTML CSS

. 1.44.

,
.


, -
, . -
. , , -
.

: ,
, -, -
.
.

,
.

, -
.
, .
- (PHP, Perl),
. ,
HTML.
97

<FORM>
<FORM>, .
, , -
.

ACTION,
. , ,
.
, PHP. 1.51
test.php, ,
.

1.51. ACTION <FORM>


<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php">
</form>
</body>
</html>

ACTION , ,
, . ,
. URL-
- .

- , ,
. -
ACTION ,
.
mailto:.
enctype="text/plain".

,
, . -
1.52 ,
.
98 1. HTML CSS

1.52.
<html>
<head>
<title> </title>
</head>
<body>
<form action="mailto:test@test.ru" enctype="text/plain">
</form>
</body>
</html>

.
, . ,
:

_=__.

METHOD. -
. -
, .
.

: GET POST.
.

GET. ,
. GET -
. ,
.
-
www.mytestserver.ru/form.php?var1=1&var2=2,
?
&.
POST. .
URL,
. POST -
.

1.53 POST,
.
99

1.53. METHOD <FORM>


<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post">
</form>
</body>
</html>

, .


,
. ,
-
. , .

<INPUT>

<INPUT> .
,
.

, , TYPE. .1.8 -
, .

1.8. TYPE


text
password
button
file
image -
checkbox


100 1. HTML CSS

1.8 ()


radio
reset
submit
hidden

NAME,
.
.
, .

, ,
. -
DISABLED.

VALUE , . ,
, . -
. ,
, ,
. , -
, .

,
.

TYPE="text".
MAXLENGHT,
,
.

SIZE. -
,
. , ,
. -
.

1.54 -
. , -
, .
101

1.54.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
: <input type="text" name="Reg_name" value=" " /><br />
: <input type="text" name="Reg_surname" value=" " /><br />
: <input type="text" name="Reg_patronymic" value=" "
/><br />
: <input type="text" name="Reg_login" maxlength="12" value="<
10 " size="14" /><br />
</form>
</body>
</html>

.1.45
1.54.

,
TYPE="password".
,
(
, )
.


.
, - . 1.45.

.

: -
. ,
.

, TYPE <INPUT>
"button". , ,
102 1. HTML CSS

TYPE="submit", , ,
TYPE="reset".

VALUE .

1.55 , -
.

1.55.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
:<br />
<input name="submit" type="submit"/><input name="reset" type="reset"/><br>
:<br />
<input name="submit" type="submit" value=""/><input name="reset"
type="reset" value=""/><br />
<input name="submit" type="submit" value=" "/><input
name="reset" type="reset" value=" "/><br />
</form>
</body>
</html>

.1.46 -
1.55.

,
-
, -
.


, -
, . 1.46.
103

, ,
. ,
.

TYPE="radio".
<INPUT>, . -
, .
, ,
NAME. VALUE
, (
).

CHECKED,
, .

1.56 -
.

1.56.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
: <input name="Reg_Gender" type="radio" value="man" />
<input name="Reg_Gender" type="radio" value="woman" />
<input name="Reg_Gender" type="radio" value="dontanswer" checked />
<br />
: <input name="Reg_Age" type="radio" value="before18" /> 18
<input name="Reg_Age" type="radio" value="1825" />18-25
<input name="Reg_Age" type="radio" value="2535" />25-35<br />
<input name="Reg_Age" type="radio" value="3550" />35-50
<input name="Reg_Age" type="radio" value="after50" /> 50<br />
</form>
</body>
</html>
104 1. HTML CSS

.1.47 1.56.

. 1.47.

,
.

,
. ,
, -
, .


.
CHECKED, .

1.57 , -
.

1.57.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
: <input name="Reg_hobby[]" type="checkbox" value="sing" />
<input name="Reg_hobby[]" type="checkbox" value="float" />
105

<input name="Reg_hobby[]" type="checkbox" value="walk" />


<input name="Reg_hobby[]" type="checkbox" value="work" checked />
<br />
<input name="Reg_hobby[]" type="checkbox" value="drive" checked />

<input name="Reg_hobby[]" type="checkbox" value="cook" />
<input name="Reg_hobby[]" type="checkbox" value="dance" />
<input name="Reg_hobby[]" type="checkbox" value="read" checked /><br
/>
</form>
</body>
</html>

.1.48 1.57.

. 1.48.

TYPE="file".
, ,
( ).

1.58 .
size 35.

1.58.
<html>
<head>
<title> </title>
</head>
<body>
106 1. HTML CSS

<form action="test.php" enctype="multipart/form-data" method="post" name="test"


target="_blank">
: <input name="Reg_foto" type="file" size="55" /><br />
</form>
</body>
</html>

.1.49 1.58.

. 1.49.

.
, .
, , -
.

TYPE= "hidden".
NAME VALUE ,
.

1.59 , -
.

1.59.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
107

<input name="id_user" type="hidden" value="27" />


</form>
</body>
</html>

.
.
.

<SELECT>. ,
. SIZE
. SIZE="1"
, .
SIZE , ,
, ; , -
. MULTIPLE
, Ctrl.

<OPTION>, -
<SELECT>. VALUE ,
.
SELECTED , .
<OPTION>, .

1.60
(
).
1.60.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post"
name="test">
:
<select name="Reg_Place" size="1" >
<option value="SPb">-</option>
108 1. HTML CSS

<option value="Mos" selected ></option>


<option value="Ebr"></option>
</select><br />
( ):<br />
<select name="Reg_Work[]" size="4" multiple="multiple" >
<option value="journ"></option>
<option value="progr"></option>
<option value="site"> </option>
<option value="HR"> </option>
<option value="sale"></option>
<option value="admin"></option>
<option value="trans"></option>
<option value="PR"></option>
</select><br />
</form>
</body>
</html>

.1.50 1.60.

,
. <TEXTAREA>,
. , ,
.
COLS ROWS: -
,
.

-

READONLY.

WRAP ,
-
.

. . 1.50.
CSS 109

WRAP :

hard ,
, ;
soft ,
, Enter;
off Enter; -
, .

1.61 : -
, .

1.61.
<html>
<head>
<title> </title>
</head>
<body>
<form action="test.php" enctype="multipart/form-data" method="post" name="test"
target="_blank">
:<br />
<textarea cols="24" rows="10" name="about"
wrap="off" > ,
.</textarea><br />
:<br />
<textarea cols="24" rows="3" name="about"
readonly > </
textarea><br />
</form></body>
</html>

.1.51
1.61.

CSS
,
HTML:
. 1.51.
110 1. HTML CSS

style p, div ., ,
, .

, -
. ,
,
. , ,
.

1.62 , .

1.62.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> </TITLE>
<LINK rel="stylesheet" href="my_style.css" type="text/css">
</HEAD>
<BODY>
<H1> </H1>
<P> .
</BODY>
</HTML>

CSS, -
. CSS /* -
*/. .
: , -
CSS-.

CSS- :

/* - */
H1 { color: blue }


CSS ,
. , -
.
CSS 111

CSS
. , , ,
.

:
H1 { color: red }
H2 { color: red }
H3 { color: red }

, :
H1, H2, H3 { color: red }

, .

,
, .
, .

, HTML- :
<H1> <EM></EM> </H1>

, <H1> .
CSS-, ,
<EM> ( ):
H1 { color: red }
EM { color: blue }

,
<EM>, , , <H1>,
CSS-:
H1 EM { color: blue }

, , ,
. , ,
, :
BODY DIV P SPAN { color: green }
112 1. HTML CSS

<SPAN>, <P>,
, , <DIV>,
. <BODY> ,
<BODY>.

, -
, . ,
.

, , :

BODY * SPAN { color: green }

, , <SPAN>
<DIV>. , -
.

, . -
, , class first.
- ,
, :

P.first + P {margin-top: -5mm }

CSS , , -
HTML-. -
:

[att] att,
;
[att=val] att
val;
[att~=val] att
, , val;
[att|=val] att -
, val. -
.
CSS 113

, .

CSS <P>, -
align, :
P[align] { color: blue;}
, CSS, SPAN,
class example:
SPAN[class=example] { color: blue; }
, <P> -
.
-

. TABLE, -
width 90%, height 50%:
TABLE[width="90%"][height="50%"] { color: blue; }
~= =.
right left align.
,
href http://www.yoursite.com/:
P[align~="right left"]
A[href="http://www.yoursite.com/"]
, lang
fr , :
*[LANG=fr] { display : none }
lang,
ru, ru, ru-RU ru-UA:
*[LANG|="ru"] { color : red }

, HTML-, -
class (.) -
~=. , DIV.value DIV[class~=value]
.
.

, class=test
:
114 1. HTML CSS

*.test { color: red } /* class=test */

.test { color: red } /* class=test */

. -
H1 class=test:

H1.test { color: green } /* H1 class=test */


H1 , :

<H1> </H1>

<H1 class="test"> </H1>

class, -
, .

, P, class
,
test marine:

P.test.marine { color: green }

, , , <P>
class="Test blue aqua marine", ,
class="test blue"

ID-

ID -
HTML-. CSS ID- -
. ID- #, -
ID.

, ID- H1, -
ID chapter7:

H1#chapter7 { text-align: center }

1.63 ,
ID first. ,
P.
CSS 115

1.63. ID-
<HEAD>
<TITLE> 7</TITLE>
<STYLE type="text/css">
*#first { letter-spacing: 0.3em }
</STYLE>
</HEAD>
<BODY>
<P id=z98y> </P>
</BODY>

1.64 -
H1, ID first.
P.

1.64. ID- H1
<HEAD>
<TITLE> 9</TITLE>
<STYLE type="text/css">
H1#first { letter-spacing: 0.5em }
</STYLE>
</HEAD>
<BODY>
<P id=first> </P>
</BODY>

, ID- , -
.


CSS -
HTML-.
, - -
. , HTML
, ,
CSS, .
116 1. HTML CSS

CSS , -
,
HTML-. , -
.

:first-child

:first-child ,
.

P,
DIV.
DIV:
DIV > P:first-child { text-indent: 0 }

P DIV
:
<P> P .
<DIV class="note">
<P> P .
</DIV>

P, ,
DIV <H2>:
<P> P .
<DIV class="note">
<H2></H2>
<P> P .
</DIV>

bold -
EM, P:
P:first-child EM { font-weight : bold }

, ,
. -
:
<P> <EM></EM> .</P>
<p> <i> <EM></EM></i></p>
CSS 117

-
. CSS :link :visited -
:

:link , ;

:visited , .

HTML <A> href.


, CSS :
A:link { color: red }
:link { color: red }

, :
<A class="external" href="http://yoursite.com/"></A>

:
A.external:visited { color: blue }

HTML- ,
. CSS
:

:hover , (
, ), ;
:active , ,
, , , ;
:focus , ,
.

, -
:
A:link { color: red } /* */
A:visited { color: blue } /* */
A:hover { color: yellow } /* ,
*/
A:active { color: white } /* */
118 1. HTML CSS

, A:hover A:
link A:visited.
color A:hover. , A:active
A:hover, ,

.

:first-line

:first-line , :

P:first-line { text-transform: uppercase }

-
. P:first-line
HTML. , -
.

, :
, .. HTML--
:

<P> HTML- .</P>

HTML-,
.

:first-line , , ,
word-spacing, letter-spacing, text-decoration, vertical-align, text-
transform, line-height, text-shadow clear.

:first-letter

:first-letter -
, . -
, float none,
.

:first-letter , , ,
, , : text-decoration, vertical-align (
float none), text-transform, line-height,
float, text-shadow clear.
CSS 119

1.65
.
1.65.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> 7. </TITLE>
<STYLE type="text/css">
P { font-size: 12pt; line-height: 12pt }
P:first-letter { font-size: 200%; font-style: italic;
font-weight: bold; float: left }
SPAN { text-transform: uppercase }
</STYLE>
</HEAD>
<BODY>
<P><SPAN></SPAN>
" HTML CSS".</P>
</BODY>
</HTML>

1.65 ,
.1.52.

. 1.52.

, -
.

.
P ,
120 1. HTML CSS

24.
, . CSS- :
P { color: red; font-size: 12pt }
P:first-letter { color: green; font-size: 200% }
P:first-line { color: blue }

:before :after

:before :after -
.

:first-letter :first-line -
:before :after, -
, :

P.special:before {content: "! "}


P.special:first-letter {color: gold}

! special,
.

CSS
-
, .

, ,
.
,
.


CSS . , ,
<BODY>, .
blue_text,
blue_text .
<P>, <BODY>, -
. - <P>,
.
CSS 121

color,
:
H1 {
color: red;
}

( );

(, #ff0000);

rgb- (, rgb(255, 0, 0)).

color , :
A:hover {
color: grey;
}

background-color.

( <H2>) HTML-
. :
H1 {
background-color: blue;
}

<H1>, <P> . . , <H1>


, <P> ,
. , -
, <H1> <SPAN>
:
H1 SPAN {
background-color: blue;
}

, , ,
.
122 1. HTML CSS


, ,
.
.

font-family ,
. ,
.
, -
. -
,
.

. ,
. CSS -
: serif, sans-serif, monospace, fantasy cursive.



, . , ,
.

(Trebuchet MS) , -
(sans-serif):
P {
font-family: "Trebuchet MS", sans-serif;
}


, , -
.

.
, -
:

serif Times New Roman, Garamond, Georgia;


sans-serif Trebuchet, Arial, Verdana;
monospace Courier, Courier New, Andele Mono.
CSS 123

, -
, , .

font-style,
: normal, oblique italic.
:

normal ;
oblique
;
italic , ,
oblique.

oblique , .
, .

font-variant : normal
small-caps. small-caps,
. normal, -
.


, font-variant small-caps,
, , ,
.
, .

font-weight ,
, . 100 900 ( 100),
, ,
, .

normal . -
400.
bold , . -
700. -
.
124 1. HTML CSS

bolder , , .
900,
900.
lighter , , .
100,
100.

font-size. -
, :
.

in ~ 2,5;

mm ;

cm ;

pt ~ 1/7 ;

pc ( 12).

em ;

ex x;

px ;

% .

,
( ).

14:
P {
font-size: 14pt;
}

CSS . -
.
CSS 125


CSS
.

HTML .
, . -
CSS text-indent. -
, ,
. 100% .
P {
text-indent: 25px;
}

, -
.

text-align, -
, align <P>:

left ;
right ;
center ;
justify .

CSS .
text-decoration.

none ;
underline ;
overline ;
line-through ;
blink .
126 1. HTML CSS


.
, .
, ,
.

none :
, .
.
underline,
. ,
( ), none.
, underline ,
:
A {
text-decoration: none;
}
A:hover {
text-decoration: underline;
}

letter-spacing. -
-
.

6:
H1 {
letter-spacing: 6px;
}

, word-
spacing.
normal, .

H1 { word-spacing: 1em }

<H1>
1em.
CSS 127

text-transform . -
:

capitalize ;

uppercase ;

lowercase .

CSS .
white-space. , -
, .

normal. -
.
pre. -
. , -
.
nowrap. ,
normal. , -
, <BR>.

BODY { white-space: pre }

HTML- , -
, .

CSS
CSS .
, .

, ( background-
color). , ..
128 1. HTML CSS

CSS .

: background-color, background-
image, background-repeat, background-attachment, background-
position background.

background-image ,
, . -
, ,
. ,
, -
( ).
. .
BODY { background-image: url("some_bgimage.gif") }
P { background-image: none }


some_bgimage.gif. <P>
, .

,
background-repeat, , -
, , .
:

repeat , ;

repeat-x ;

repeat-y ;

no-repeat :
.
:

BODY {
background: white url("pendant.gif");
background-repeat: repeat-y;
background-position: center;
}

. -
.
CSS 129

, background-
attachment, , -
( fixed)
( scroll) .

-
, background-position. -
, .

, . ,
2cm 2cm, 2
2 , .

. -
, .

top left left top 0% 0%.

top, top center center top 50% 0%.

right top top right 100% 0%.

left, left center center left 0% 50%.

center center center 50% 50%.

right, right center center right 100% 50%.

bottom left left bottom 0% 100%.

bottom, bottom center center bottom 50% 100%.

bottom right right bottom 100% 100%.

,
background. :
BODY { background: url("chess.png") gray 50% 20% repeat fixed }
.


- .

, , ,
. ,
130 1. HTML CSS

. margin
. : margin-top,
margin-right, margin-bottom margin-left
, .

margin , .

. .

. .
.
Auto. . -
.

CSS,
, 2em:

H1 { margin-top: 2em }

:
margin. ,
. , -
, .
, , -
, . , ,
, , , , , -
. :

BODY { margin: 1em 2em 3em }

HTML-, , ,
, , 1em, 2em, 3em 2em.

: padding-top, padding-right, padding-


bottom padding-left, , , , ,
. padding
. .

, , -
, . , -
CSS 131

,
, auto.

,
background:
H1 {
background: white;
padding: 1em 2em;
}

, , .

border-top-width, border-right-width,
border-bottom-width border-left-width, , -
, , , .

border-width
. border-width ,
. ,
, ..

thin ;
medium ;
thick ;
, , ,
.

-
thin, mediun thick.

, .


: border-top-color, border-right-color, border-bottom-color
132 1. HTML CSS

border-left-color ( border-color).
, , .
,
transparent. transparent, ,
, .

:
P {
border-width: 2px
border-color: blue;
}

P 2.


border-top-style, border-right-style,
border-bottom-style border-left-style ( -
border-style). (,
, ..), .
:

none ( border-width );
hidden none,
, ;
dotted ;
dashed ;
solid ;
double ; -

border-width;
groove ;
ridge (
groove);
inset ;
outset ( inset).

.
groove, ridge, inset outset ,
color.
CSS 133

border-style .
, -
, border-width.

#xyz { border-style: solid dotted }


solid, dotted.

none,
, .


, ( <DIV>).
,
.

. -
HTML-.
,
.
. .

position float , -
.

static. ,
. left top .
relative.
( ).
. -
, -
, .
absolute. ( )
left, right, top bottom.
134 1. HTML CSS

. -
. ,
. ,
.
fixed. -
, -
.
( ). -
, -
, (,
). , -
fixed -.

, , position -
, static. -
,
:

top -
;
right
;
bottom
;
left -
.


.
-
( left right) ( top bottom)
. ,
, ,
top bottom, auto.
auto , ,
, auto.
CSS 135

,

. -
, , , -
.

, -
. float , , ,
. ,
, .
.

left , . -
, (
clear). display ,
none.
right left ,
, .
none .

, IMG -
class="icon", :
IMG.icon {
float: left;
margin-left: 0;
}

HTML- 1.66.
1.66.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> </TITLE>
<STYLE type="text/css">
IMG { float: left }
BODY, P, IMG { margin: 2em }
</STYLE>
136 1. HTML CSS

</HEAD>
<BODY>
<P><IMG src="img.gif" alt="
">
, ...
</BODY>
</HTML>

, IMG, .
, ,
. ,
, .
, -
( (), P). -
, HTML- -
:

<BODY>
<P> ,
<IMG src="img.gif" alt=" ">
...
</BODY>

, ,
, , .

-
. ,
, -
.
. , , -
, .

-
. -
, .1.53.

HTML ,
1.67.
CSS 137

. 1.53.

1.67.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> CSS</TITLE>
<STYLE type="text/css">
BODY { height: 8.5in } /* */
/* , */
/* */
#header {
position: fixed;
width: 100%;
height: 15%;
top: 0;
right: 0;
bottom: auto;
138 1. HTML CSS

left: 0;
}
#sidebar {
position: fixed;
width: 10em;
height: auto;
top: 15%;
right: auto;
bottom: 100px;
left: 0;
}
#main {
position: fixed;
width: auto;
height: auto;
top: 15%;
right: 0;
bottom: 100px;
left: 10em;
}
#footer {
position: fixed;
width: 100%;
height: 100px;
top: auto;
right: 0;
bottom: 0;
left: 0;
}
</STYLE>
</HEAD>
<BODY>
<DIV id="header"> ... </DIV>
<DIV id="sidebar"> ... </DIV>
<DIV id="main"> ... </DIV>
CSS 139

<DIV id="footer"> ... </DIV>


</BODY>
</HTML>

, ,
.

, -
z-index . :

auto -
;
-
, .
, .

, 1.68.
id,
text2 .
z-index.

1.68. OZ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> z</TITLE>
<STYLE type="text/css">
.pile {
position: absolute;
left: 2in;
top: 2in;
width: 3in;
height: 3in;
}
</STYLE>
</HEAD>
<BODY>
140 1. HTML CSS

<P>
<IMG id="image" class="pile"
src="someimg.gif" alt=""
style="z-index: 1">
<DIV id="text1" class="pile"
style="z-index: 3">
.
</DIV>
<DIV id="text2">
.
</DIV>
<DIV id="text3" class="pile"
style="z-index: 2">
text1, .
</DIV>
</BODY>
</HTML>
.
.
, , .

.


, -. -
HTML CSS --
, HTML- ,
. CSS
, HTML-
.


. , ,
. , , .
2

JavaScript
JavaScript

JavaScript


HTML

142 2. JavaScript

JavaScript. ,
JavaScript .

, , -
.

JavaScript -
, C, Perl Python. -
Java,
, , .

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

-.

, -
, - .

, , -
, - .

JavaScript , -
-.

JavaScript
JavaScript -
. ,
, , , ,
-
, - .
JavaScript -,
. -
Google, Google Calendar
- Google Doc&Spreadsheet -
,
-. -
143

HTML Dynamic HTML (-


HTML), JavaScript.

JavaScript , , , -
, Adobe Dreamweaver, Adobe Acrobat Reader Adobe Photoshop
, Visual Basic Microsoft Office.

HTML--
.


JavaScript-
HTML-.

,

htm html. , Windows
WordPad.
, -,
Microsoft FrontPage Adobe Dreamweaver ( Macromedia
Dreamweaver). -
, -
, . -
,
HTML JavaScript, .

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

, -, -
- --
. , , --
, . ,
- -,
, .
144 2. JavaScript

- , , --
Microsoft Internet Explorer. , - -
-, -
Windows. -
Mozilla Firefox Opera, -
. Mozilla Firefox http://www.mozilla.ru/, Opera -
http://www.opera.com/.

(). ,
,
, (
). ,
. ,
-
,
.

JavaScript. , -
Microsoft Script Debugger -
JavaScript. - Microsoft Internet Explorer.
Microsoft,
http://msdn.microsoft.com/scripting/. , -
Microsoft FrontPage Microsoft Script
Editor, Microsoft Script Debugger.

, - Mozilla Firefox
. , FireBug
https://addons.mozilla.org/firefox/1843/, -
- Mozilla Firefox, .

,
, . , -
.


-.

HTML- :

<script>.
145

, - -
<a>, href , -
. -
JavaScript-, javascript:
( ). :

<a href="javascript:alert(', !');"> </a>

, -
JavaScript

alert(', !');

, (.2.1).

. 2.1.

alert(),
, .
.

,
-. , :
, HTML-.
- , ,
. HTML
, . -
JavaScript, -
, :

<p onclick="alert(' !');"> </p>


146 2. JavaScript

<p> , -
. onclick,
. -
.2.2.

. 2.2.

HTML .

, .

<script>

HTML <script>.
HTML- - , -
</script> - .
type. ,
JavaScript :

<script type="text/javascript">

</script>

, text/javascript -
.

, -
JavaScript. // <!--
e . , .

<script>
//
// ,

147

<!--

//
</script>

,
. -
/* */, , , :

<script>
/*

*/

</script>

-, ,
. <script> src, -
. JavaScript
.js, , , lib1.js. , -
HTML- lib1.js,
:

<script type="text/javascript" src="lib1.js"></src>

-
, , .
- ,
.

.

, ,
<head>,
. 2.1 -,
HTML-.

2.1. -
<html>
<head>
<title> </title>
148 2. JavaScript

<!-- -->
<script type="text/javascript" src="lib1.js"></src>
<!-- , -->
<script type="text/javascript">
... // JavaScript
</script>
</head>

<body>
... <!-- -->

<script type="text/javascript>
<!--
... // -
//-->
</script>

... <!-- -->

<p onclick="..."> , </p>

... <!-- -->


</body>
</html>

, HTML-
JavaScript. , . ,
, .


-
, , !!!.
JavaScript , .

, JavaScript .
, ,
149

. , , if If JavaScript
. , .

1. , -
.
2. .
3. 2.2.

2.2.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1251">
<title> </title>
</head>
<body>
<script type="text/javascript">
for (var i = 0; i < 10; i++)
{
document.write(", !!!");
}
</script>
</body>
</html>
4. , script1.html.
- , ,
-. , ,
-.
5. - -.

, , -
, !!! (.2.3).

,
-, -, -
-.
- .
150 2. JavaScript

. 2.3. -


JavaScript
JavaScript: , ,
, , .. ,
.


,
, , , ,
, , ,
..


, .

, ( );

, ;

, URL;

, ,
, ;
, .
JavaScript 151

/ JavaScript
: alert(), prompt() confirm().
.

alert()

alert()
. -
OK, . .

, ,
(2.3).

2.3.
<html>
<head>
<title> </title>
</head>
<script>
alert(" ");
</script>
<body>
</body>
</html>

,
-
. .2.4 , -
-
Internet Explorer.
. 2.4.

prompt()

prompt() (2.4).

2.4.
<html>
<head>
<title> </title>
</head>
152 2. JavaScript

<script>
//
var nameUser;
// nameUser
nameUser=prompt(", ?", "");
// alert()
alert(" , "+ nameUser);
</script>
<body>
</body>
</html>

.
. ,
. ,
. ,
, .

(.2.5),
.


prompt() -
, alert() -
.
.

prompt() -
,
. . 2.5.

confirm()

confirm() ,
: OK Cancel (). 2.5
, -
OK Cancel.

2.5.
<html>
<head>
JavaScript 153

<title> </title>
</head>
<script>
confirm(" ");
</script>
<body>
</body>
</html>

-
(.2.6).

-
OK
Cancel.
. 2.6.


,
, . -
. JavaScript : ,
, .

, , -
. ,
. -
:

:
A Z a z;
(_)
, ;
($)
.
154 2. JavaScript


, -
, flagId FlagID. -
, .

.2.1 .

2.1. JavaScript


count 2my
x new
X my
is_well is well

, new, -
, ,
.

,
JavaScript.
. -
. .2.2 JavaScript.

2.2. JavaScript

break else new typeof


case finally null var
catch for return void
continue function switch while
default if this with
delete in throw
do instanceof try

-
, -
. .2.3.
JavaScript 155

2.3. JavaScript

abstract enum int short


boolean export interface static
byte extends long super
char final native synchronized
class float package throws
const goto private transient
debugger implements protected volatile
double import public

, -
JavaScript. , -
. JavaScript
: , .

JavaScript :
. , 1, 2, 3,
, 1, 2, 3, . ,
,
.

0
9, .


0 7, .


0 9 a f, 0x.

(.2.4).

2.4.


45 055 0x2d
255 0377 0xff
10000000 046113200 0x989680
10 012 0XA
156 2. JavaScript

.
.
e E. -
.
.

1,4142135623730950488016887242097
-35.0
4567.0002
3.4e100
-5.456e-3
0.007

JavaScript , -
: true () false (). ()
,
.


true false -
.

JavaScript
. ( ), -
. ,
- . -
:

" "
"!"
"4567"
""
' '
' " "'

-
, .
Unicode-, -
\u \uXXXX. .2.5
.
JavaScript 157

2.5.

Unicode

\b \u0008 (backspace) <BS>


\t \u0009 <HT>
\n \u000A ( ) <LF>
\v \u000B <VT>
\f \u000C <FF>
\r \u000D <CR>
\" \u0022 "
\' \u0027 '
\\ \u005C \

(-
2.6).

2.6.
<html>
<head>
<title> </title>
</head>
<script>
alert(":\t\t\n:\t\t\n:\t&K");
</script>
<body>
</body>
</html>

, alert(),
, -
-.
Microsoft Internet Explorer
(.2.7).
. 2.7.

, ,
: .
, , , alert(),
. , (
158 2. JavaScript

). (,
document), . , null
.

, ,
.
.

, -
.

, -
. ,
var .
, :
var myData1;
var x,y,z;
var k, msg1, msg2, IM;

,
:
var myStr=", ";
var k=1000, x=12, y=5;
var s=1.34e-5, msg11="Error", Flag=false;

, undefined.
, typeof,
(2.7).
2.7.
<html>
<head>
<title> </title>
</head>
<body>
<h2> </h2>
<pre>
<script>
JavaScript 159

//
var i=45.78, msg="";
var f=false, y;
//
document.write("\n"+" i="+i+" - "+ typeof(i)+"\n");
document.write(" msg="+msg+" - "+ typeof(msg)+"\n");
document.write(" f="+f+" - "+ typeof(f)+"\n");
document.write(" y ="+y+" - "+ typeof(y)+"\n");
// y
y=null;
document.write(" y="+y+" - "+ typeof(y)+"\n");
</script>
</pre>
</body>
</html>


document.write(), -
(.2.8).

. 2.8.
160 2. JavaScript

,
.
.

. ,
, ,
.
. .
.

, .
,
.
.

(-
2.8).

2.8.
<html>
<head>
<title> </title>
<script>
// 5
var stars= new Array(5);
//
stars[0]='';
stars[1]='';
stars[2]='';
stars[3]='';
stars[4]='';
//
alert(stars[0]);
//
alert(stars);
</script>
</head>
JavaScript 161

<body>
</body>
</html>

, -
, -
. , JavaScript -
, stars[0].

JavaScript ,
. . -
,
(.2.9).


.

(2.9).
. 2.9.
2.9.
<html>
<head>
<title> </title>
<script>
//
var stars= new Array('','','','','');
//
alert(stars[0]);
//
alert(stars);
</script>
</head>
<body>
</body>
</html>

, JavaScript .
. ,
n, n+1.
length (2.10).
162 2. JavaScript

2.10.
<html>
<head>
<title> </title>
<script>
//
var stars= new Array('','','','','');
stars[99]='';//
//
alert(stars.length);
</script>
</head>
<body>
</body>
</html>

-
6, 100
(.2.10). . 2.10.


, . -
,
. , 4+6 ,
10. q=5 q 5.
, ,
. JavaScript.

. -
:

a=7

msg1=msg2=""
JavaScript 163


(.2.6).

2.6.


x += y x=x+y
x = y x = x y

x *= y x=x*y
x /= y x=x/y
x %= y x=x%y
x <<= y x = x << y
x >>= y x = x >> y

x >>>= y x = x >>> y
x &= y x=x&y
x ^= y x=x^y
x |= y x=x|y

(+). , 5 + 7 = 12.

(). , 67 43 = 24.

(*). , 2 * 2 = 4.

(/). , 45 / 5 = 9.

(%). , 7% 5 = 2.

-
( ).
++, --.
, i++ i=i+1.

. -
, -
:

i = 4
++i * 2 = 10
164 2. JavaScript

, ,
:
i = 4
i++ * 2 = 8

2.11 .
2.11.
<html>
<head>
<title> </title>
</head>
<body>
<h2> </h2>
<pre>
<script>
var i=5, z;
document.write("\n i="+i+"\n");
z=i+56*2;
document.write("z=i+56*2="+z+"\n");
z=6.7*2-i;
document.write("z=6.7*2-i="+z+"\n");
z=i++ +10;
document.write("z=i++ +10="+z+"\n");
document.write(" i="+i+"\n");
z=--i *4;
document.write("z=--i *4="+z+"\n");
document.write(" i="+i+"\n");
z=(5+11)%8;
document.write("z=(5+11)%8="+z+"\n");
</script>
</pre>
</body>
</html>

, -
. , (.2.11).
JavaScript 165

,
.

. 2.11.

. -
, ,
. .2.7 .

2.7.


== true,
!= true,
> true,
>= true,

< true,
<= true,

=== true,

!== true,

166 2. JavaScript

2.12 , .

2.12.
<html>
<head>
<title> </title>
</head>
<body>
<h2> </h2>
<pre>
<script>
var i=5, m1="1";
var m2;
document.write("\n i="+i+"\n");
document.write("i>7 - ");
//
document.write(i>7);
document.write("\n(3+i)>=8 - ");
//
document.write((3+i)>=8);
m2="1"
document.write("\n m1="+m1);
document.write(", m2="+m2+"\n");
document.write("m1!=m2 - ");
document.write( m1!=m2);
m2="2"
document.write("\n m1="+m1+", m2="+m2+"\n");
document.write("m1<=m2 - ");
document.write(m1<=m2);
m2="5"
document.write("\n i="+i+", m2="+m2+"\n");
document.write("i==m2 - ");
document.write(i==m2);
document.write("\ni===m2 - ");
document.write( i===m2);
document.write("\ni===5 - ");
JavaScript 167

document.write(i===5);
</script>
</pre>
</body>
</html>

i=5 m2="5".
, (.2.12).

. 2.12.

, . ,
(+), . :

S1="";
S2=",";
S3="!";
S=S1+S2+" "+S3;

S ", !".

""+2008=" 2008"
168 2. JavaScript

, -
. JavaScript .

(&&) true, .
, (1<7)&&(3>2).

(||) true, -
. , (2<3)||(1>2).

(!)
.

JavaScript ?:, -
. :

var sign = (a>=0) ? "": "";

:
, , ,
, . , -
a 0, sign "-
", "".

JavaScript (, ), -
,
.


JavaScript -
( if switch),
. -
(while, for do). -
.

if

if .
:
JavaScript 169

if ( )
{

}

, , true, -
; false,
.

. , f(x) :

x + 10, x < 0

f(x)= x2 + 4, 0 x 5

5 / x, x > 5

-
, 2.13.

2.13. if
<html>
<head>
<title> if</title>
<script>
var x, y;
// x
x=prompt (" x","0");
//
x=+x;
//
if (x<0){
y=x+10;
}
if ((x>=0)&&(x<=5)){
y=x*x+4;
}
if (x>5){
y=5/x;
170 2. JavaScript

}
alert(" f("+x+")="+y);
</script>
</head>
<body>
</body>
</html>

if..else

.
, ,
false:

if ( )
{
1
}
else
{
2
}

, else if.

:

if ( 1)
{
1
}
else if ( 2)
{
2
}
else
{
3
}
JavaScript 171

-
if..else (2.14).

2.14. if..else
<html>
<head>
<title> if..else</title>
<script>
var x, y;
// x
x=prompt (" x","0");
//
x=+x;
//
if (x<0) y=x+10; // x<0
else if (x>5) y=5/x; // x>5
else y=x*x+4; // 0<=x<=5
alert(" f("+x+")="+y);
</script>
</head>
<body>
</body>
</html>

, ,
.
.

switch

switch .
if,
switch :

switch ()
{
case 1:

case 2:
172 2. JavaScript


..
default:

}

, , -
(2.15).

2.15. switch
<html>
<head>
<title> switch</title>
<script>
var trans;
//
var beast=prompt (" ","dog");
//
switch (beast)
{
case "dog":
trans="";
break;
case "cat":
trans="";
break;
case "cow":
trans="";
break;
default:
trans=" "
}
alert(beast+" "+trans);
</script>
</head>
<body>
JavaScript 173

</body>
</html>


(.2.13).

break, -

switch.
switch . 2.13.
switch
.

for

for .
:

for ( ; ; )
{

}


. ,
false.
. ,
.

2.16 , n!=1 2 3
n for.

2.16. for
<html>
<head>
<title> for</title>
<script>
var f=1;
var x=prompt (" ","5");
x=+x;
for(var i=1;i<=x;i++)
{
174 2. JavaScript

f=f*i;
}
alert(f);
</script>
</head>
<body>
</body>
</html>

1 x, -
. , ,
Infinity () x.

while

while for,
. :

while ( )
{

}

while , -
.

2.17 , -
while.

2.17. while
<html>
<head>
<title> while</title>
<script>
var f=1;
var x=prompt (" ","5");
x=+x;
var i=1;
while(i<=x)
{
JavaScript 175

f=f*i;
i++;
}
alert(f);
</script>
</head>
<body>
</body>
</html>

do..while

do..while while.
, -
, , :
do
{

} while ( )

2.18 , -
do..while.
2.18. do..while
<html>
<head>
<title> do..while</title>
<script>
var f=1;
var x=prompt (" ","5");
x=+x;
var i=1;
do
{
f=f*i;
i++;
} while(i<=x)
alert(f);
176 2. JavaScript

</script>
</head>
<body>
</body>
</html>

for..in

for..in -
. :

for ( in )
{

}

,
(2.19).

2.19. for..in
<html>
<head>
<title> for..in </title>
<script>
var a = new Array (5,76,43,12,77,-5, 0);
for (var i in a)
{
a[i]++;
}
alert(a);
</script>
</head>
<body>
</body>
</html>


a
1 (.2.14). . 2.14.
JavaScript 177

break continue


. break continue. -
break
, . continue -
. -
2.20.

2.20.
<html>
<head>
<title> </title>
<script>
var a= new Array (5,0,2,0-3,0);
var b= new Array();
//
while(true)
{
var x=prompt (" ","0");
//
x=+x;
// ,
//
if (x==0) {break}
// ,
for (var i=0; i<a.length; i++)
{
// a
if (a[i]==0)
{
b[i]="-";
// for,
//
continue;
}
178 2. JavaScript

//
b[i]=x/a[i];
}// for
alert(a+"\n"x+"\n"+b);
}// while
</script>
</head>
<body>
</body>
</html>


-
a. -
,
b -
. -
. 2.15.
.2.15.


. while , (
). , . for
, a (-
).


,
- .
. .

,
. :

function ([1][,..N])
{

}
JavaScript 179

function .
( ) , -
.
, .

<script>.
<head> -
, , -
. 2.21 .
2.21.
<html>
<head>
<title> </title>
<script>
//
var a = new Array (1,2,4,8);
function sum()
{
var s = 0; //
// a
for (var i in a)
{
s=s+a[i];
}
alert(" ="+s);
}
function product()
{
var p=1; //
for (var i in a)
{
p=p*a[i];
}
alert(" ="+p);
}
180 2. JavaScript

</script>
</head>
<body>
<script>
var x=prompt(" (0 1)?","0");
if (x=="0")
{
sum();
}
if (x=="1")
{
product();
}
</script>
</body>
</html>

, -
0 1. sum()
product(), , , -
a.

. -
return. , -
. 2.22
.

2.22.
<html>
<head>
<title> </title>
<script>
function sum(a,b)
{
return (a+b);
}
</script>
JavaScript 181

</head>
<body>
<script>
var x1=5, x2=6, x3=3, x4=3;
// (x1+x2)*(x3+x4)
alert (sum(x1,x2)*sum(x3,x4));
</script>
</body>
</html>

. ,
, :

var cube=function(x){return x*x*x}


alert(cube(2)+cube(3));

-, .

, -
. arguments.
, ,
. , -
:

var arg1=arguments[0];

, , . -
, ,
length arguments.

2.23 -
.

2.23.
<html>
<head>
<title> </title>
<script>
function sum(x1,x2) //
182 2. JavaScript

{
var s=0; //
//
for (var i=0;i<arguments.length;i++)
{
s+=arguments[i];
}
return (s);
}
</script>
</head>
<body>
<script>
//
alert (sum(1,2,3,4));
alert (sum(1,-3,40,2,5,7));
</script>
</body>
</html>

, , -
-
. , ,
,
. -:
, .
. ,
10000,
-
. , -
.

JavaScript ,
.
JavaScript 183

, , ..
,
.

, onLoad() - ,
-. -
JavaScript- , -
.

. -
onClick() JavaScript,
2.24.

2.24.
<html>
<head>
<title> </title>
<script>
function mes()
{
alert (" ");
}
</script>
</head>
<body>
<h2> </h2>
<a href=http://www.myserver.ru/page1.html onClick="mes()"> 1</a>
<br>
<a href=http://www.myserver.ru/page2.html
onClick="alert(' ')"> 1
</a>
</body>
</html>

, ,
JavaScript-.
alert() (.2.16).
184 2. JavaScript

. 2.16.

JavaScript
JavaScript () , -
(). , -
. , JavaScript
:

Global , -
;
String ;

Number ;

Boolean ;

Array ;

Function ;

Date ;

Math ;
JavaScript 185

RegExp
( );
Object .

Global

,
(.2.8). Global.

2.8. Global


Infinity ,

NaN ,
undefined
escape() , ,
-,

eval() JavaScript

isFinite() ,
( NaN
Infinity)
isNaN() ,
( NaN)
parseFloat()

parseInt()
string()
unescape()
ASCII-
ISO-Latin-1

-
. , :

flag=isFinite(x/y);

String

String
. (.2.9).
186 2. JavaScript

2.9. String


constructor ,
length
prototype

String :

MyText=" HTML";
MyText=(MyText.substring(0,8)+"JavaScript").bold();

MyText "<b> JavaScript</b>".


Number

Number -
, . -
.2.10.

2.10. Number


constructor ,
MAX_VALUE
(1,7976931348623157e+308)
MIN_VALUE
(5e-324)
NaN
NEGATIVE_INFINITY

POSITIVE_INFINITY

prototype
toSource() , Number
toString()
valueOf() Number

Boolean

Boolean
. ,
.2.11.
JavaScript 187

2.11. Boolean


prototype
toString() true false

Array

. ,
, . -
.2.12.

2.12. Array


constructor ,
index ,
, ,

input , -
,
length
prototype
concat()
join()
pop()

push()

reverse()
shift()

slice()

splice() /
sort()
toSource() ,

toString() , -

unshift()

valueOf() ,
188 2. JavaScript

Function

Function .
(.2.13).

2.13. Function


arguments
arguments.callee
arguments.caller ,

arguments.length arguments
arity
constructor ,

length arity
prototype
apply()

call()

toSource() ,

toString() toSource()
valueOf()

Function :

= new Function ([1, 2,.. N],


);

sumFunc = new Function ("a","b","return(a+b)");


alert(sumFunc(5,4));

Date

Date ,
(.2.14). 1
1970. JavaScript ,
.
JavaScript 189

2.14. Date


constructor ,

prototype

= new Date();
= new Date();
= new Date(" , ::");
= new Date(, , [, , , -
]);

, , -
00:00:00 1 1970. ( );
, , , , , , , , ,
;
, , , , , , ,
.

,
.

, ,
:

MyDate=new Date();
alert(MyDate.getDay());

0 6, (, 0-
).

Math

Math JavaScript. -
(.2.15).
190 2. JavaScript

2.15. Math


E ( e)
LN10
LN2
LOG10E e
10
LOG2E e 2
PI
SQRT1_2 1/2
SQRT2 2
abs()
acos() ( )
asin() ( )
atan() ( )
atan2()

( )
ceil() ,

cos()
exp() ,

floor() ,

log()
max() 2
min() 2
pow() ,
, ,

random() ,
0 1
round()
sin()
tan()
sqrt()
toSourse()
toString()
191

Object

JavaScript, , ,
Object, ,
(.2.16).

2.16. Object


constructor ,

prototype
toLocaleString()

toSource() ,
toString() ,

valueOf()


JavaScript - ,
-
.

,
.
-.

JavaScript, String, Math .


,
.

- HTML-
HTML-.
, -, , , ,
, . JavaScript
HTML-. .
192 2. JavaScript

-.
, Window, Navigator, Screen, History Location.
:

Window , ;
Navigator , ;
Screen , ;
History , ;
Location , URL- .

JavaScript Window. , -
, , -
.

- HTML-.
Document. , HTML
, , , , , -.

, .
, . -
JavaScript : o..
, - JavaScript
: document.bgColor = "yellow". document
(-, HTML-), bgColor
Document ( -) yellow bgColor.

, .
JavaScript
o.eo(). , JavaScript
- Hello, world!, :
document.write("Hello, world!"). document , write
, Document, ,
write. -
, .

JavaScript .


JavaScript -
.
.
193

JavaScript (.2.17).

. 2.17. JavaScript

Window,
. -
. Window
, .

Location URL-
HTML-, Frame
HTML- .
History -.

- Document.
HTML. -: ,
HTML- -
, , URL- , .. -
Document.

HTML- , -
. Form,
Document. Form
, ,
.
.

- HTML
. , -
(-), . ,
, (, img), -
.
194 2. JavaScript

HTML-, -
(2.25).
2.25. HTML-
<HTML>
<HEAD>
<TITLE>JavaScript Objects</TITLE>
</HEAD>
<BODY>
<H1> JavaScript</H1>
<P> </P>
</BODY>
</HTML>

JavaScript.
HTML- Document.
, -. -
, HTML-.

<HTML>
-. <HEAD> <TITLE>. <TITLE>,
, JavaScript Objects. <BODY>
: <H1> <P>. JavaScript -
<H1>,
<P>.

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

-
, JavaScript -
HTML, , -
. .

Window
Window
JavaScript.
195

Window ,
, ,
:

defaultStatus , -
;
status , ;

frames ;

length ;

name , open, -
TARGET <A> NAME <FORM>;
parent , , ;

self window , ;

top , .

C frames, length, parent top ,


HTML . length -
, frames ( )
. , ,
,
.

Window -
2.26.

2.26. status Window


<HTML>
<HEAD>
<TITLE> status Window</TITLE>
</HEAD>
<BODY>
<SCRIPT language="JavaScript">
window.status=" !"
</SCRIPT>
<P> !</P>
</BODY>
</HTML>
196 2. JavaScript

(.2.18).

. 2.18.

, Window, ,
, -
, :

alert Alert ()
OK;
open ;

close ;

confirm Confirm ()
OK ;
prompt Prompt () ;

setTimeout ;

clearTimeout .

alert, prompt confirm . -


, , Window.
, , ,
Window. Window:
window.alert(). .

close . confirm (-
2.27).

2.27. close
<HTML>
<HEAD>
197

<TITLE> close</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function okno()
{
if (confirm(" ?") )
{
window.close();
}
</SCRIPT>
</HEAD>
<BODY onLoad="okno()">
</BODY>
</HTML>

2.27 okno().
confirm,
.

OK, true,
false.

, okno()
Window close.
. close .

open JavaScript -
HTML .

open : open(' URL',


'_', config=' 1, 2, 3,, -
n').

open URL- HTML, -


, data.html.
HTML- ,
http:// , http://www.mysite.ru/
download/javascript.html.

open -
TARGET <A> <FORM>.
198 2. JavaScript

"". , -
, joe. -
TARGET.

onfig ,
:

width ( );

height ( );

toolbar yes 1, -
; no, -
;
location , HTML--
( );
status ;

menubar ;

scrollbars ;

resizable yes 1, -
.

onfig -
, .

, open (-
2.28).

2.28. open
<HTML>
<HEAD>
<TITLE> open</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
window.open('okno2.html', 'joe', config='height=250,width=300,toolbar=no,
menubar=no,scrollbars=no, resizable=yes,location=no,status=yes')
</SCRIPT>
</BODY>
</HTML>
199

okno.html okno2.html -
. 300 250. -
, ,
config, no. -
, status=yes.
,
resizable=yes.


. -
, , -
.

Window setTimeout.

. -
: setTimeout("cmd", timeout). , -
timeout ( ), JavaScript,
cmd.

, setTimeout, 2.29.

2.29. setTimeout
<HTML>
<HEAD>
<TITLE> setTimeout</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function timer()
{
idTimer=window.setTimeout("alert(' !')", 3000);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" value="Timer" onClick="timer()">
</FORM>
</BODY>
</HTML>
200 2. JavaScript

2.29
Timer, Alert
3 (.2.19).

setTimeout() Window.
3000 (3) ,
. . 2.19. Alert


alert: "alert(' !')".

clearTimeout ,
setTimeout. clearTimeout -
, setTimeout, clearTimeout(idTimer).

setTimeout clearTimeout
( )
. -

JavaScript.

Window, ,
onLoad onUnload. ,
, HTML.

,
. ,
, ,
. onUnload
-
-.


, onLoad onUnload
<BODY>.

HTML, -
2.30.

2.30. onLoad onUnload


<HTML>
<HEAD>
<TITLE> onLoad onUnload</TITLE>
201

</HEAD>
<SCRIPT LANGUAGE="JavaScript">
function hello()
{
alert(" !")
}
function bye()
{
alert(" ! , !")
}
</SCRIPT>
<BODY BGCOLOR=white onLoad="hello()" onUnload="bye()">
</BODY>
</HTML>

<BODY> onLoad onUnload.


hello,
bye.

Navigator

JavaScript, -
, Navigator.
- -
. -
.

JavaScript, Navigator -
. .

appCodeName (, ) .

appName () , Netscape
Microsoft Internet Explorer.
appVersion , , -
.
userAgent , ,
, -
. appCodeName appVersion.
202 2. JavaScript

cookieEnabled ,
cookies, -
. true,
cookie.
browserLanguage .

systemLanguage ,
ru, Windows.
userLanguage
.
platform , -
Win32.
cpuClass () -
, x86 Alpha.

,
( 2.31).

2.31.
<HTML>
<HEAD>
<TITLE> Navigator</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
var an = navigator.appName;
var av = navigator.appVersion;
var acn = navigator.appCodeName;
var ua = navigator.userAgent;
var cook = navigator.cookieEnabled;
var blang = navigator.browserLanguage;
var slang = navigator.systemLanguage;
var ulang = navigator.userLanguage;
var platf = navigator.platform;
var cpu = navigator.cpuClass;
document.write("<b> </b> "+an+" <b></b> "+av+"<br><b>
</b> "+acn+" <b> </b> "+ua+"<br><b>
203

cookies </b>"+cook+"<br><b> </b>"+blang+


"<br><b> by default </b>"+slang+"<br><b>
</b>"+ulang+ "<br><b> </b>"+platf+"<br><b> -
</b>"+cpu)
</SCRIPT>
</BODY>
</HTML>

Navigator
. document.write -
- (.2.20).

. 2.20.

Screen

Screen
: , , -
.. -
, .

Screen :

width ( );

height ( );
204 2. JavaScript

availHeight

;
availWidth

;
colorDepth ; 16 2,
256 8, 16,7 ( High Color) 32;
updateInterval ( )
. 0 ,
.

,
(2.32).

2.32. Screen
<HTML>
<HEAD>
<TITLE> Screen</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
document.write('width: '+window.screen.width+'<br>');
document.write('availWidth: '+window.screen.availWidth+'<br>');
document.write('height: '+window.screen.height+'<br>');
document.write('availHeight: '+window.screen.availHeight+'<br>');
document.write('colorDepth: '+window.screen.colorDepth+'<br>');
document.write('updateInterval: '+window.screen.updateInterval)
</SCRIPT>
</BODY>
</HTML>

.2.21.

- .
Screen, JavaScript
- .
205

History

History
Window. -
-
-
. URL-
, -
. -
History
URL-, -
.
. 2.21.
History -
length.
- .
2.33 ,
.

2.33. -
<HTML>
<HEAD>
<TITLE> </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
function hislen()
{
alert(window.history.length)
}
</SCRIPT>
<INPUT type="button" onclick="hislen()" value=" -
">
</BODY>
</HTML>

hislen(), Alert -
. -
.
206 2. JavaScript

, , -
(.2.22).

-
-
History:
. 2.22.
go - -
-
,
( 0,
1, , , 2 ..);
back -, (-
go(-1));
forward - , -
( go(1)).

, ,
2.34.

2.34.
<HTML>
<HEAD>
<TITLE> </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
function goback()
{
window.history.go(-2)
}
</SCRIPT>
<INPUT type="button" onclick="goback()" value=" 2 -
">
</BODY>
</HTML>

(.2.23), goback(), -
.
207

History,

. , -


. - -
,

.

. 2.23.
Location

URL- -
.

Location JavaScript
URL, -.

Location
HTTP-:

href URL- -;

hash URL- -,
name ( );
host URL- ,
;
hostname , --
;
pathname - ;

port HTTP-, -
- ( , 80
, HTTP);
protocol , HTTP, FTP . (
, http:);
search (
"?").

href Location
2.35.
208 2. JavaScript

2.35. href Location


<HTML>
<HEAD>
<TITLE>URL HTML-</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
document.write(location.href);
</SCRIPT>
</BODY>
</HTML>

URL-
HTML-. -
-
location.href
(.2.24).

Location -
-
URL, --
.
-
. . 2.24.
, -
.

Location :

assign , URL- -
, ;
reload - ( ,
, -
);
replace - , URL-
;
HTML .

2.36 , -
Location replace.
209

2.36. replace
<HTML>
<HEAD>
<TITLE> replace</TITLE>
<SCRIPT LANGUAGE=JavaScript>
function replaceDoc()
{
window.location.replace("http://www.yandex.ru")
}
</SCRIPT>
</HEAD>
<BODY>
<input type="button" value="Replace" onclick="replaceDoc()" />
</BODY>
</HTML>

-
www.yandex.ru. replaceDoc, -
Replace.

, Location -
HTML-, , ,
-.

, , . HTML--
JavaScript .


HTML, ,

(Document Object Model, DOM). DOM
-, ,
.

Document

HTML JavaScript
Document. , JavaScript
210 2. JavaScript

, ,
.

-, , -
. HTML-
-, , ,
, , ..

- HTML-, -
HTML. HTML-
Document,
JavaScript.

Document DOM.
.

,
, , (-
).
, Document.

Document :

anchors (), HTML-


; <a name="..."> </a> -
-;
links HTML-,
<a href="..."> </a>;
images -;

forms HTML.

JavaScript ,
, HTML-
.

, Document,
2.37.
2.37. anchors
<HTML>
<HEAD>
<TITLE>Anchors</TITLE>
211

</HEAD>
<BODY>
<a name="first">1 anchor</a><br />
<a name="second">2 anchor</a><br />
<a name="third">3 anchor</a><br />
<br /> HTML-:
<SCRIPT LANGUAGE=JavaScript>
document.write(document.anchors.length)
</SCRIPT>
</BODY>
</HTML>

anchors
HTML-. document.write
(.2.25).

. 2.25. anchors

document.anchors.
length, length ,
.

,
-. anchors document.
anchors.length : links, images
forms.
212 2. JavaScript

, Document ,
JavaScript
-. Document.

alinkColor ALINK.
, .
linkColor LINK. ,
HTML, .
vlinkColor VLINK.
, HTML,
.
bgColor BGCOLOR.
HTML-. -
(, #F0F8FF),
(, red white).
fgColor TEXT, .
, - ( BGCOLOR).
lastModified HTML.
location URL- -.
referrer URL- ,
-.
title , <TITLE>.
URL URL- HTML.

Document -
HTML-, <BODY>, ,
, .

Document JavaScript
, . , -
JavaScript HTML: ,
,
(2.38).

2.38. Document
<HTML>
<HEAD>
<TITLE> Document</TITLE>
213

<SCRIPT LANGUAGE="JavaScript">
document.bgColor = "#00FF80";
document.fgColor = "#800080";
document.linkColor = "#000000";
document.alinkColor = "#FF0000";
document.vlinkColor = "#4000FF";
</SCRIPT>
</HEAD>
<BODY BGCOLOR=white>
<H1> </H1>
<H3> : </H3>
<P><A HREF="http://www.yandex.ru">Yandex</A>
<P><A HREF="http://www.mail.ru"> </A>
<P><A HREF="http://www.microsoft.com"> Microsoft</A>
</BODY>
</HTML>

.2.26.

. 2.26. ,

, -, -
BGCOLOR=white <BODY>.
214 2. JavaScript

,
lastModified Document ( 2.39).

2.39. lastModified
<HTML>
<HEAD>
<TITLE> lastModified</TITLE>
</HEAD>
<BODY>
<center>
<SCRIPT LANGUAGE="JavaScript">
document.write(" :<br>" +document.
lastModified)
</SCRIPT>
</center>
</BODY>
</HTML>

lastModified

HTML-.
document.lastModified.
document.write()
- (.2.27).


JavaScript
document.write. -
, JavaScript
, - . 2.27.
Document. lastModified

getElementsByName({_}) ,
.
getElementById({ID}) ,
. ID. -
.
215

getElementsByTagName({ }) , -
.
write HTML- .

getElementsByTagName JavaScript
. (2.40).

2.40. getElementsByTagName
<HTML>
<HEAD>
<TITLE> getElementsByTagName</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function getElements()
{
var x=document.getElementsByTagName("input");
alert(x.length);
}
</SCRIPT>
</HEAD>
<BODY>
<input name="myInput" type="text" size="30" /><br />
<input name="myInput" type="text" size="30" /><br />
<input name="myInput" type="text" size="30" /><br />
<br />
<input type="button" onclick="getElements()" value="
input" />
</BODY>
</HTML>

getElements(),
input
-, Alert
(.2.28).

.
, HTML- . 2.28.

, input: -
(.2.29).
216 2. JavaScript

. 2.29. input

Document
, -.

JavaScript -,

.
-.

HTML- JavaScript -
.
.

, -
img1, img2 img3. ,
.
- Document. -
images.
images[0], images[1], images[2] ..
, , .
,
document.images[0].

.
- ,
.
217

, , -
, value . -
JavaScript :

Name = document.forms[0].elements[0].value

-
name. , -
JavaScript.

-
. ,
document.forms[4].elements[15],
.

JavaScript
Document, -
. , name:
<form name="myform">. , --
, forms[0], myform.

.
elements[0] name, name= document.
forms[0].elements[0].value name= document.myform.element_
name.value.

HTML-, -
, JavaScript,
-, .


.
Myform myform, JavaScript
.

, HTML- -
:

.
,
218 2. JavaScript

. JavaScript
.

,
-.

2.41 , , -
, -
.
2.41.
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function doit()
{
var greeting=" "
alert(greeting + document.aform.color.value
+ " " + document.aform.geometr.value)
var prich=", "
alert(prich + document.aform.prichina.value)
alert(" "
+ document.aform.geometr.value.length)
}
</SCRIPT>
</HEAD>
<BODY>
<center>
<FORM NAME="aform">
:
<INPUT TYPE="text" NAME="geometr"><p>
:
<INPUT TYPE="text" NAME="color"><p>
:
<INPUT TYPE="text" NAME="prichina"><p>
<INPUT TYPE="button" VALUE="" onClick="doit()">
</FORM>
219

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

HTML-

(.2.30). -
onClick
doit(),
,
.



-
- . 2.30.
.

aform. -
: geometr, color prichina. -
value.
Document, ,
, , , .

: document.
aform.geometr.value. , doit() -
value geometr, aform
HTML- document. -
.


Alert (.2.31).

, HTML-:
- .
.
, , . 2.31.

--
.

,
JavaScript.
220 2. JavaScript

-,
JavaScript.


,
- , . -
. JavaScript
-
(-
3).
. , -
,
.

JavaScript :
. -
, .

, JavaScript -
. -
.


Form -
. <form>
.

HTML Form :

<form
[name=""]
[accept=""]
[accept-charset=""]
[action="URL"]
[enctype=""]
[metod=get|post]
[target=""]
221

[id=""]
[class=""]
[style=""]
[title=""]
[lang=""]
[dir=""]
[onclick=""]
[ondblclick=""]
[onmousedown=""]
[onmouseup=""]
[onmouseover=""]
[onmousemove=""]
[onkeypress=""]
[onkeydown=""]
[onkeyup=""]
[onsubmint=""]
[onreset=""]
</form>

Document .
Form ( Name). -
, -
document... ,
myelement myform -
:

document.myform.myelement.value=" ";

.2.32.

, Document forms, -
. , Form elements,
. ,
,

document.forms[0].element[0].value=" ";

: myform -
(forms[0]), myelement -
(element[0]).
222 2. JavaScript

. 2.32.

,
.
, , , , ..

. , ,
. elements -
. 2.42 , -

.

2.42.
<html>
<head>
<title> </title>
<script>
//
function validateForm(){
223

var validateFlag=true; //
for (var i=0; i<6; i++) //
{
// countElem .
// ,
var countElem=document.regform.elements[i];
if (countElem.value=="") // ?
{ // ,
validateFlag=false; // false
//
alert (" "+countElem.name);
break; //
}
}
//
return validateFlag;
}
</script>
</head>
<body>
<h2> </h2>
<!-- -->
<form name="regform" metod="post" onsubmit="return validateForm();">
<!-- -->
<table width="100%">
<tr>
<!-- -->
<td>:<sup>*</sup></td>
<!-- -->
<td><input type="text" size="35" name="firstname"></td>
</tr>
<tr>
<td>:<sup>*</sup></td>
<!-- -->
224 2. JavaScript

<td><input type="text" size="35" name="lastname"></td>


</tr>
<tr>
<td> Email:<sup>*</sup></td>
<!-- Email -->
<td><input type="text" size="35" name="email"></td>
</tr>
<tr>
<td>:<sup>*</sup></td>
<!-- -->
<td><input type="text" size="35" name="login"></td>
</tr>
<tr>
<td>:<sup>*</sup></td>
<!-- -->
<td><input type="password" size="20" name="pass1"></td>
</tr>
<tr>
<td> :<sup>*</sup></td>
<!-- -->
<td><input type="password" size="20" name="pass2"></td>
</tr>
<tr>
<td>:</td>
<!-- -->
<td><select size="1" name="country">
<!-- -->
<option value="Russia"></option>
<option value="Ukraine"></option>
<option value="Belorussia"></option>
<option value="USA"></option>
<option value="France"></option>
<option value="Great Britain"></option>
225

<option value="other"></option>
</td>
</tr>
<tr>
<td> :</td>
<td>
<!-- -->
<input type="radio" name="sex" value="male"><br />
<input type="radio" name="sex" value="female"><br/>
</td>
</tr>
<tr>
<td colspan=2>
<!-- -->
<input type="checkbox" name="consent">
.</td>
</tr>
<tr>
<td colspan=2> , ( <sup>*</sup> ),
.</td>
</tr>
<tr>
<!-- -->
<td><input type="submit" value=""></td>
<td><input type="reset" value=""></td>
</tr>
</table>
</form>
</body>
</html>

(.2.33)
. validateForm() -
.
226 2. JavaScript

. 2.33.

,
, (.2.17).

2.17. ,


action reset() onReset
enctype submit() onSubmit
elements[]
length
method
name
target

action

action URL- ,
:
227

<form name="myform"
action=http://www.myserver.com/cgi-bin/registation.asp
metod="post">
<!-- -->
</form>

URL- JavaScript:

<script>
function handler (){
alert(' JavaScript');
void(0);
}
</script>
<form name="myform"
action="handler();"
metod="post">
<!-- -->
<input type=submit value=" JavaScript action">
</form>

, JavaScript.

enctype (encoding)

enctype (encoding) MIME- .


application/x-www-form-urlencoded.

elements[]

elements[] . -
forms.
. , text c email -
HTML, -
:

formName.elements[2].value
formName.elements["email"].value
formName.email.value
228 2. JavaScript

length

length . ,

:

document.forms[2].elements.length

method

method .
, HTML-
, .
, -
GET POST.

GET POST ,
. JavaScript- -
. ,
GET POST.

<form name="myform">
<!-- post method-->
<input type=button
onclick="document.myform.method='post';
alert(document.myform.method);" value=" post">
<!-- get method-->
<input type=button
onclick="document.myform.method='get';
alert(document.myform.method);" value=" get">
<input type=submit value=" ">
</form>

(.2.34),
method, .

name

name name .
.
229

. 2.34. metod

target

target , -
.
. ,
_self, _blank, _top _parent.

reset()

reset() .
Reset.
:

<form name="myform">
1: <input type="text" SIZE=60
value=" 1" name="text1"></br>
2: <input type="text" SIZE=60
value=" 1" name="text1"></br>
3: <input type="text" SIZE=60
value=" 1" name="text1"></br>
<!-- , -->
<input type=button value=" "
onClick="document.myform.elements[0].value=' ';
document.myform.elements[1].value=' ';
document.myform.elements[2].value=' ';">
230 2. JavaScript

</form>
<a href="javascript:document.myform.reset();void(0);">
</a>

submit()

submit() .
Submit.
, ,
:

<form name="myform"
action="http://myserver.com/cgi-bin/script.cgi">
1: <input type="text" SIZE=60 name="text1"></br>
2: <input type="text" SIZE=60 name="text1"></br>
3: <input type="text" SIZE=60 name="text1"></br>
</form>
<a href="javascript:document.myform.submit();">
</a>

onReset

reset . -
Reset reset().
:

<form name="myform"
onReset="javascript:alert(' ');
return true;">
1: <input type="text" size=60
value=" 1" name="text1"></br>
2: <input type="text" size =60
value=" 1" name="text2"></br>
3: <input type="text" size =60
value=" 1" name="text3"></br>
<input type=reset value="">
</form>
231


true false, -
.

onSubmit

submit Submit
submit(). . -
onSubmit ,
. false ,
return, .
, -
. , submit.

<script>
//,
function checkSubmit() {
//
if (document.myform.text1.value==""){
// ,
//
alert(' ');
return false; }
else {//,
return true }
}
</script>
<form name="myform" onSubmit="return checkSubmit();"
action="http://myserver.com/cgi-bin/reg.pl>
: <input type="text" size=60 name="text1"></br>
<input type=submit value="">
</form>


,
JavaScript .
232 2. JavaScript

(2.43) -
. ,
ax2+bx+cx=0.


x1=(-b+D)/2a, x2=(-b-D)/2a,

D , :
D=b2-4ac.

a, b c
.
2.43.
<html>
<head>
<title> </title>
<script>
//
// .
function Calculate(FormObj){
// ,
//
var a=FormObj.a.value*1;
var b=FormObj.b.value*1;
var c=FormObj.c.value*1;
// a, b c
// , inNaN true
if (isNaN(a)){
alert("a ");
return;
}
if (isNaN(b)){
alert("b ");
return;
}
233

if (isNaN(c)){
alert("c ");
return;
}
//,
// a
// a b , .
if (a==0){
if (b==0){
// c<>0
FormObj.x1.value="";
FormObj.x2.value="";
FormObj.D.value="";
return;
}
// ,
FormObj.x1.value=c/b;
FormObj.x2.value=c/b;
FormObj.D.value="";
return;
}
//
var Dis=b*b-4*a*c;
FormObj.D.value=Dis;
if (Dis<0){
alert(" ");
FormObj.x1.value=" ";
FormObj.x2.value=" ";
return;
}
else{
//
Dis=Math.sqrt(Dis);
//
FormObj.x1.value=(-b+Dis)/(2*a);
234 2. JavaScript

FormObj.x2.value=(-b-Dis)/(2*a);
}
}
</script>
</head>
<body>
<h2></h2>
<form name="cal">
<table>
<tr>
<td>a:</td>
<td><input type="text" size=30 name="a"></td>
</tr>
<tr>
<td>b:</td>
<td><input type="text" size=30 name="b"></td>
</tr>
<tr>
<td>c:</td>
<td><input type="text" size=30 name="c"></td>
</tr>
<tr>
<td>D:</td>
<td><input type="text" size=30 name="D"></td>
</tr>
<tr>
<td>x1:</td>
<td><input type="text" size=30 name="x1"></td>
</tr>
<tr>
<td>x2:</td>
<td><input type="text" size=30 name="x2"></td>
</tr>
</table>
235

<input type="button" Value=""


onClick="Calculate(this.form)">
</form>
</body>
</html>

, Calculate()
. , -
(.2.35).

. 2.35.

, , .
, ,
.


. 2.44 ,
.

2.44.
<html>
<head>
<title></title>
236 2. JavaScript

<script>
//
UrlYandex="http://www.yandex.ru/yandsearch?rpt=rad&text=";
UrlRambler="http://www.rambler.ru/srch?words=";
UrlAport="http://sm.aport.ru/scripts/template.dll?That=std&r=";
UrlGoogle="http://www.google.ru/search?hl=ru&newwindow=1&q=";
function FindText(Url){
var FullUrl=Url+document.find.searchtext.value;
//,
if (document.find.newwin.checked){
var FindWin=window.open(FullUrl);
}
else{
location.href = FullUrl;
}
}
</script>
</head>
<body>
<form name="find">
:<br>
<input type="text" name="searchtext" size=40><br>
<input type="checkbox" name="newwin"> <br>
<br> :<br>
<input type="button" value="Yandex"
onClick="FindText(UrlYandex)">
<input type="button" value="Rambler"
onClick="FindText(UrlRambler)">
<input type="button" value="Aport"
onClick="FindText(UrlAport)">
<input type="button" value="Google"
onClick="FindText(UrlGoogle)">
</form>
</body>
</html>
HTML 237

FindText(),
(.2.36).

. 2.36.

,
- .
.

-
.
,
.

,
, , , . ,
site=www.mysite.ru:
http://www.yandex.ru/yandsearch?site=www.mysite.ru&rpt=rad&text=

HTML
JavaScript -
. HTML
JavaScript ,
238 2. JavaScript

, . -
, .
, ,
.


, -
. HTML -
, ,
. , , -
, , .. -
. -
,
. , .

(DOM). -
, .

JavaScript
: , , ,
, , , .

DOM- .
, , .. Node,
DOM. Node ,
(.2.18).

2.18. Node


nodeName

nodeValue

nodeType
,
Node
parentNode
Node
childNodes ,
, NodeList
HTML 239


firstChild
Node
lastChild
Node
previousSibling Node
nextSibling Node
attributes ,
, NamedNodeMap
ownerDocument Document,
namespaceURI URI

prefix
localName
,

baseURI URI ,

textContent
#text
insertBefore(newChild, newChild
refChild) refChild
replaceChild(newChild,
oldChild) oldChild newChild
removeChild(oldChild) oldChild

appendChild(newChild) newChild

hasChildNodes() true,
, false
cloneNode(deep) . -
deep true, -
,
normalize()
Text
isSupported(feature, version) true, -
feature version,
false
hasAttributes() true,
, false

Node, -
.
240 2. JavaScript

, DOM-
JavaScript. -
:

getElementsByTagName(),
;
getElementById(), id -
;
documentElement Document DOM,
.

2.45 , View1(),
View2() View3(),
. JavaScript
, .

2.45.
<html>
<head>
<title> </title>
<script>
// <h2>
function View1(){
// <h2>
var H2List=document.getElementsByTagName("h2");
//
var Header1=H2List.item(0);
//
alert(Header1.firstChild.nodeValue+" "+Header1.tagName);
}
// <h2>
function View2(){
// id="h2Tag2"
var Header2=document.getElementById("h2Tag2");
//
HTML 241

alert(Header2.firstChild.nodeValue+" "+Header2.tagName);
}
// <h2>
function View3(){
// DOM- Mozilla Firefox
if (navigator.appName=="Netscape") {
// <body>
var BodyNode= document.documentElement.childNodes[2];
// <h2>
var Header3=BodyNode.childNodes[7];
//
alert(Header3.firstChild.nodeValue+" "+Header3.tagName);
}
// DOM- Opera
if (navigator.appName=="Opera") {
// <body>
var BodyNode= document.documentElement.childNodes[1];
// <h2>
var Header3=BodyNode.childNodes[7];
//
alert(Header3.firstChild.nodeValue+" "+Header3.tagName);
}
// DOM- Microsoft Internet Explorer
if (navigator.appName=="Microsoft Internet Explorer") {
// <body>
var BodyNode= document.documentElement.childNodes[1];
// <h2>
var Header3=BodyNode.childNodes[3];
//
alert(Header3.firstChild.nodeValue+" "+Header3.tagName);
}
}
</script>
</head>
242 2. JavaScript

<body>
<!-- , -->
<h2 id="h2Tag1"> </h2>
<h2 id="h2Tag2"> </h2>
<h2 id="h2Tag3"> </h2>
<form>
<input type=button value="1" onClick="View1();">
<input type=button value="2" onClick="View2();">
<input type=button value="3" onClick="View3();">
</form>
</body>
</html>

1 getElementsByTagName()
<h2>. .
. item()
NodeList.


, -
DOM. -
#text. , <h2> , -
firstChild
Node.

2 getElementById() -
h2Tag2 . ,
(.2.37).

3 View3(),
DOM- .
. documentElement -
Element, .
, <body> BodyNode,
<h2>. View3()
, Opera Mozilla Firefox
, . ,
, ,
. , -
.
HTML 243

. 2.37.

, -
(<>) . , <img> src,
. , -
getAttribute() Element.
(2.46).
2.46.
<html>
<head>
<title> </title>
</head>
<body>
<h2 id="h2Tag" align="center"></h2>
<form>
<input type="text" id="text1"><br>
<input type=submit id="But" >
</form><br>
<script>
//
var Elem=document.getElementById("h2Tag");
244 2. JavaScript

//
document.write(": "+Elem.tagName+", id=");
document.write(Elem.getAttribute("id")+", -"
+Elem.getAttribute("align"));
document.write("<br>");
//
Display(document.getElementById("text1"));
//
Display(document.getElementById("But"));
//,
function Display(El){
document.write(": "+El.tagName+", id=");
document.write(El.getAttribute("id")+", -"
+El.getAttribute("type"));
document.write("<br>");
}
</script>
</body>
</html>

getAttribute() -
, (.2.38).
,
Didsplay(),
Element.

. 2.38.
HTML 245

, . -
setAttribute() Element. -

(2.47).
2.47.
<html>
<head>
<title> </title>
<script>
//,
function Change(){
//
var Elem=document.getElementById("h2Tag");
// align
Elem.setAttribute("align","left");
// ,
var Elem=document.getElementById("iTag");
//
Elem.firstChild.nodeValue="2";
}
</script>
</head>
<body>
<h2 id="h2Tag" align="center"></h2>
<i id="iTag"></i>
<form>
<input type=button id="But" value="" onClick="Change();">
</form>
</body>
</html>

Change(),
. setAttribute()
. <i>,
, (.2.39).
246 2. JavaScript

. 2.39.

-
- ,
, . ,
, -
.

-
.

(rollover) :

onMouseDown ,
;
onMouseUp ,
;
onMouseOver ,
;
onMouseOut ,
.

2.48.
HTML 247

2.48.
<html>
<head>
<title></title>
</head>
<body>
<h2> </h2>
<a href="javascript:void(0)"
onMouseDown="document.pic.src='onMouseDown.gif'"
onMouseUp="document.pic.src='onMouseUp.gif'"
onMouseOver="document.pic.src='onMouseOver.gif'"
onMouseOut="document.pic.src='onMouseOut.gif'">
<img src="onMouseOut.gif" border=0 name="pic">
</a>
</body>
</html>

onMouseOut.gif,
- (.2.40).

. 2.40.

, .
, 2.48, -
248 2. JavaScript

,
.
. ,
, ,
(2.49).

2.49.
<html>
<head>
<title>C </title>
<script>
//
// 6 , 0
numerals=new Array(6);
letters=new Array(6);
//
for(var i=1;i<6;i++){
//
numerals[i] =new Image();
letters[i] =new Image();
//
numerals[i].src ="img"+i+".gif";
letters[i].src ="pic"+i+".gif";
}
//, onMouseOut
function ImageOut(img){
document.images[img-1].src=numerals[img].src;
}
//, onMouseOut
function ImageOver(img){
document.images[img-1].src=letters[img].src;
}
</script>
</head>
<body>
HTML 249

<h2>C </h2>
<!-- -->
<a href="javascript:void(0)"
onMouseOver="ImageOver(1)"
onMouseOut="ImageOut(1)">
<img src="img1.gif" width=81 height=81>
</a>
<a href="javascript:void(0)"
onMouseOver="ImageOver(2)"
onMouseOut="ImageOut(2)">
<img src="img2.gif" width=81 height=81>
</a>
<a href="javascript:void(0)"
onMouseOver="ImageOver(3)"
onMouseOut="ImageOut(3)">
<img src="img3.gif" width=81 height=81>
</a>
<a href="javascript:void(0)"
onMouseOver="ImageOver(4)"
onMouseOut="ImageOut(4)">
<img src="img4.gif" width=81 height=81>
</a>
<a href="javascript:void(0)"
onMouseOver="ImageOver(5)"
onMouseOut="ImageOut(5)">
<img src="img5.gif" width=81 height=81>
</a>
</body>
</html>

, -
1 5.

A E (.2.41).
250 2. JavaScript

numerals
letters. , 6, -
. ,
document.images[] -
ImageOut() ImageOver(),
.

. 2.41. C

.
, -
. , ,
. , 2.49
:
<img src="img1.gif" width=81 height=81 onMouseOver="ImageOver(1)"
onMouseOut="ImageOut(1)" onClick="javascript:void(0)">

-
src . -
Window: setTimeout() setInterval().
2.50.
<html>
<head>
<title> </title>
HTML 251

<script>
//
numerals=new Array(6);
//
for(var i=1;i<6;i++){
//
numerals[i] =new Image();
//
numerals[i].src ="img"+i+".gif";
}
//,
function animation(count){
//
document.images[0].src="img"+count+".gif";
count--;//
// , animation()
if (count>=0){
//
setTimeout("animation("+count+");",1000);
}
}
</script>
</head>
<body>
<h2> </h2>
<img src="img5.gif" width=81 height=81 onClick="animation(5)">
</body>
</html>

animation() ,
, , -
1. .
,
.
5,
5 0 (.2.42).
252 2. JavaScript

. 2.42.


HTML-
, .

<div>,
. ,
, .

- .
, position z-index.
, z-index (2.51).

2.51.
<html>
<head>
<title> </title>
<script>
//,
function move(){
//
var Layer1=document.getElementById('first');
var Layer2=document.getElementById('second');
HTML 253

//
if (Layer1.style.zIndex<Layer2.style.zIndex){
// 2
Layer1.style.zIndex=1;
Layer2.style.zIndex=0;
}
else{
//
Layer1.style.zIndex=0;
Layer2.style.zIndex=1;
}
}
</script>
</head>
<body>
<h2> </h2>
<div id=first style="position:absolute; top:50px;left:50px;
height:100px;width:250px; background-color:orange; z-index:0">
1
</div>
<div id=second style="position:absolute; top:80px;left:80px;
height:100px;width:250px; background-color:yellow; z-index:1">
2
</div>
<!-- , , -->
<!-- move() -->
<div id=control style="position:absolute; top:200px;left:80px;">
<a href="javascript:move();"> </a>
</div>
</body>
</html>

getElementById().
, , .
(.2.43).
254 2. JavaScript

. 2.43.

visibility,
. :

hidden ;

inherit , (
);
visible .

2.52 .

2.52.
<html>
<head>
<title> </title>
<script>
//,
function vis(){
//
var Layer=document.getElementById('lay');
//
if (Layer.style.visibility=='hidden'){
// ,
Layer.style.visibility='visible';
}
HTML 255

else{
// ,
Layer.style.visibility='hidden';
}
}
</script>
</head>
<body>
<h2> </h2>
<div id=control style="position:absolute; top:50px;left:50px;">
<a href="javascript:vis();">/ </a>
</div>
<div id=lay style="position:absolute; top:70px;left:50px;
height:100px;width:250px; background-color:orange;
visibility:hidden">
, ,

</div>
</body>
</html>

,
(.2.44).

. 2.44.
256 2. JavaScript

JavaScript
, , -
.


getElementById(). -
(2.53).
2.53.
<html>
<head>
<title> </title>
<style type="text/css">
p {
color:black;
font-size: 14pt;
font-style:normal;
}
</style>
<script>
//,
function Change1(){
par.style.color="red"; //
par.style.fontSize="16pt"; // 16
par.style.fontStyle="italic"; //
}
//,
function Change2(){
par.style.color="black";
par.style.fontSize="14pt";
par.style.fontStyle="normal";
}
</script>
</head>
<body>
<h2> </h2>
HTML 257

<p> .<p>
<p id="par" onMouseOver="Change1()" onMouseOut="Change2()">
, .
</p>
</body>
</html>

par :
.
,
(.2.45).

. 2.45.


JavaScript , -
, , -
. , backgroundColor textDecoration.


, .
. ,
(2.54).
2.54.
<html>
<head>
<title></title>
<script>
258 2. JavaScript

var vx;//
var vy;//
var flag;//,
//
function init(){
flag=false;//
lay.style.backgroundColor="orange";//
//
//
lay.style.top=Math.round((Math.random()*450));
lay.style.left=Math.round((Math.random()*750));
//
vx=Math.round((Math.random()*10))-5;
vy=Math.round((Math.random()*10))-5;
move();//
}
//,
function move(){
// ,
if (flag==true){return}
//
var x=lay.style.left;
var y=lay.style.top;
// 10%
if (Math.round((Math.random()*1000))<10){
vx=Math.round((Math.random()*10))-5;
vy=Math.round((Math.random()*10))-5;
}
//
x=parseInt(x)+vx;
y=parseInt(y)+vy;
//
if (x<=0){
x=0;
vx=-vx;
HTML 259

}
if (x>=750){
x=750;
vx=-vx;
}
if (y<=0){
y=0;
vy=-vy;
}
if (y>=450){
y=450;
vy=-vy;
}
//
lay.style.left=x;
lay.style.top=y;
// 30
setTimeout("move();",30);
}
//,
function vis(){
//
document.forms[0].Yes.value++;
// , move()
flag=true;
//
lay.style.backgroundColor="red";
// 400
setTimeout("init();",400);
}
</script>
</head>
<body onLoad=init()>
<!-- -->
<div id=field style="position:absolute; top:0px;left:0px;
260 2. JavaScript

height:500px;width:800px; background-color:yellow;"
onClick='javasript:document.forms[0].No.value++;'>
</div>
<!-- -->
<div id=lay style="position:absolute; top:50px;left:50px;
height:50px;width:50px; background-color:orange;" onClick='vis()'>
</div>
<!-- -->
<div id=control style="position:absolute; top:0px;left:800px;
height:500px;width:200px; background-color:green;">
<form>
<h2></h2>
: <br>
<input id="Yes"> <br>
:<br><input id="No">
</form>
</div>
</body>
</html>

, -
(.2.46).

800500
. .
, . , -
, 5050.
init(),
. -
0 750, 0 450.
5 5.
move().
. -
10% .
30 move() .
vis(),
. , 400,
init().
261

. 2.46.

, . ,
, , -
..

JavaScript.
,
- .

.
HTML -
. -
.

HTML JavaScript, -.
3

Apache, Perl MySQL


Apache
Perl
MySQL

Apache 263

- Apache MySQL
-, Perl. ,
.

Apache
- -
Apache. , -, -
, -, . ,
Apache , -
,
.

Apache
, , ..
, -
, Perl.

Apache
Apache -.
, HTML--
.

- , http://www.
google.ru, -, ,
, HTML-.

, Apache ( -).

.
http, https .
. - , -
.
( ) .
, - ,
html-, - -
. -
PHP, Perl, MySQL.
264 3. Apache, Perl MySQL

. ,
, , -
.
. -
,
.

- Apache , -
. , -
. -
. Apache ,
-. : -
( )
.

, Apache -
, . , , Apache
: -
. IP- DNS.
,
, IP-. -
.

Apache
HTTP.

Apache
Apache, , -
. , , .

, - Apache . -
, , http://httpd.apache.org.
: -
, :

UNIX Source: httpd-2.2.9.tar.gz [PGP] [MD5];

Win32 Source: httpd-2.2.9-win32-src.zip [PGP] [MD5];

Win32 Binary without crypto (no mod_ssl) (MSI Installer);


Apache 265

Win32 Binary including OpenSSL 0.9.8h (MSI Installer);

Windows ( ).
, , ,
Apache .

, .

1. (Setup Wizard) apache_2.2.9-win32-


x86-no_ssl-r2.msi, .
2. Next ().
3. .
(Iaccept the terms in the license agreement)
Next.
4. Apache (.3.1): ()
. (as a Service) .

. 3.1.

5. :
Typical () Apache;

Custom () ,
Apache, , . ,
Typical ( -
).
266 3. Apache, Perl MySQL

Apache.

, Apache - -
, -
, . -
(.3.2).

. 3.2.

, , :
( , Internet Explorer) ,
127.0.0.1 192.168.0.1 ( http://localhost/).

Apache , It
works! (.3.3).

. 3.3. Apache

Apache.
Apache 267

Apache
Apache, ,
. -
Apache , .
: , ,
, .

Apache httpd.conf. -
Program Files\Apache Software Foundation\Apache2.2\
conf, .

httpd.conf Notepad (.3.4).

. 3.4. httpd.conf

, #. ,
Apache ( ).
Apache
, .

, Apache.
, Apache ,
.
(/), -
Apache . (.3.5)
Restart.
268 3. Apache, Perl MySQL

. 3.5. Apache

() ?

, Apache,
. 127.0.0.1
80, IP-.

Listen:

Listen 12.34.56.78:80

Listen 80

IP- ,
Apache, ( IP- ).
,
, .

ServerRoot. ,
.
:

ServerRoot "D:/Program Files/Apache Software Foundation/Apache2.2"


:

ServerRoot "D:/MySite"
Apache 269

: http://
12.34.56.78/file.html Apache file.html D:\
MySite.

, Apache, ,
index.html, :

<html><body><h1>It works!</h1></body></html>

It Works! Apache.

Apache .
VirtualHost,
:

<VirtualHost 127.0.0.1>
ServerAdmin master@dummy-host.example.com
DocumentRoot "d:/mysite/1"
ServerName dummy-host.example.com
CustomLog dummy-host.example.com-access_log common
</VirtualHost>

IP-, ( ,
IP , ,
127.0.0.2, 127.0.0.3) DocumentRoot.

127.0.0.* ,
. ,
213.180.204.11, , , . ,
. -
Apache ,
.

ErrorLog CustomLog. Errorlog


, ,
, CustomLog
. -, -
.

,
, hosts Windows
.
270 3. Apache, Perl MySQL

, , LoadModule.
:

LoadModule alias_module modules/mod_name.so

Apache .

Perl
Perl -
, . Perl -
- PHP Java.

80- . XX., WWW


. Perl ,
-:
, -
.

Perl JavaScript VBScript,


? -
. , .
Perl ,
- , .
.

, , --
: , -
.

Perl Apache
Perl , www.activestate.
com. -, ,
Downloads, ActivePerl.
.

ActivePerl Windows MSI,


.

, .
Perl 271

, ActivePerl (.3.6).

. 3.6.

.
,
(. 3.7).

. 3.7.
272 3. Apache, Perl MySQL

: Apache Perl.
httpd.conf Options FollowSymLinks ExecCGI.

#AddHandler cgi-script .cgi,


#. .cgi .pl, -
Perl .

<FilesMatch "\.cgi$">
Options ExecCGI
</FilesMatch>

Apache , Perl.

httpd.conf Apache.

.
printenv.cgi , DocumentRoot
httpf.conf, :

#!c:/Perl/bin/perl.exe
print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}

Perl, httpd.conf, -
, perl--
.

, :
, Windows.

. -
http://192.168.0.1/printenv.cgi.

, (.3.8).

, - .
Perl 273

. 3.8.

: -,
-, -, , -
. , -
Apache ( logs , Apache).

access.log error.log.
. ,

192.168.0.1 - - [10/Jul/2008:13:06:38 +0400] "GET /printenv.cgi HTTP/1.1"


404209

404 printenv.cgi :
- .

192.168.0.1 - - [10/Jul/2008:13:07:25 +0400] "GET /printenv.cgi HTTP/1.1"


500535

500 , .

, ,

192.168.0.1 - - [10/Jul/2008:13:07:39 +0400] "GET /printenv.cgi HTTP/1.1"


200 1410

200 , .
274 3. Apache, Perl MySQL

error.log.

[Thu Jul 10 13:06:38 2008] [error] [client 172.16.0.3] D:/Program Files/


Apache Software Foundation/Apache2.2/htdocs/config.cgi is not executable;
ensure interpreted scripts have "#!" first line

, Perl.

, ,
Apache. Apache
-
.


Perl, .

, Perl -. --
: , , -
, - ( ActivePerl).
,
Windows, -.
, - UNIX.

Perl , , , Java .
, .
:

$a = '';
$a = 12;
print $a;

a ( $, @)
, . -
,
. Perl ,
.

print ( 12).
.

Perl , . -
,
Perl 275

. , print '$a\n'
$a\n. print "$a\n" a -
.
, .

, Perl -
for, while do. -
, : , ,
, :
for($i = 0; $i< 100;$i++)
{ print $i; }

i 0 99
: 0123456789101112131415

-, , while:
$i=10;
while ($i > 0)
{
print $i;
} continue {$i-}

-
, 10.

, , ,
. , Perl break, continue
. Perl
:

Last ;

Next ;

Redo .

Perl-, ,
HTML-.
#!c:/Perl/bin/perl.exe
print "Content-type: text/plain; charset=iso-8859-1\n\n";
276 3. Apache, Perl MySQL

print "<html><body><table>";
for($i = 1; $i< 10;$i++)
{
print "<tr>";
for($j = 1; $j< 10;$j++)
{
print "<td width=70 style='border-left:1px solid #707070;border-bottom:1px
solid #f0f0f0;'>";
print $i*$j, "</td>";
}
print "</tr>";
}
print "</table></body></html>";


(.3.9).

. 3.9.
Perl 277

, ,
HTML-. Perl -
: .
,
.

, Perl.

. , HTML
.
, . Perl
,
, , , . ,
.
. Perl
-
, -
( , ..).
,
, , ,
. , , -
, . -
.
.

HTML- : -
print. Perl
, :

print <<HTML;
<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<H1><CENTER> ! </CENTER></H1>
HTML
Print "</BODY></HTML>";

print <<HTML HTML html-,


.
278 3. Apache, Perl MySQL

Perl

Perl .

, HTML
- . ,
-
- ,
.

HTML, Perl
HTML.
:

<form method=post action="form.cgi">


<b> :</b>
<input name="user_name" size=20>
<b> :</b> <input name="user_fam" size=20>
<input type="submit" value="OK">
</form>

OK,
form.cgi (.3.10).

. 3.10.
Perl 279

. -
Perl, HTML . Perl
:

, ,
- , -
,
;
( !
-mail) .

-
user_name user_fam, input.

form.cgi ( HTML-
FORM) :

#!c:/Perl/bin/perl.exe
print "Content-type: text/plain; charset=iso-8859-1\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split('&', $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$input{$name} = $value;
print "$name : $value<br>";
}
print "<h3>",$input{'user_name'},", , </h3>";
print ' <a href="/proceed.html"></a>, .';

$buffer ,
Perl ( read).
: 1=1&2=2&
.
280 3. Apache, Perl MySQL

split, -
@pairs. - (
&).

foreach =
@pairs. -
$name $value. $value
. ,
HTTP , , -
, 7- :
%C2%E0%F1%E8%EB%E8%E9.

$input{$name}=$value -
input.

.3.11.

. 3.11.

, .
.
Perl 281

Perl : , -
, :
open (HANDLE, ">>myfile");
print HANDLE ": ", $input{'user_name'},"\n";
close (HANDLE);

myfile :
, .
, .

(, , ),
:
open (HANDLE, "myfile");
while($line=<HANDLE>)
{
print $line;
}

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

Perl , -
. -

Sendmail ( ).
:
$sendto = 'manager@mysite.ru';
open (MAIL, "| /usr/bin/sendmail $sendto")
print MAIL "From: - <zakaz@mysite.ru>\n";
print MAIL "To: $sendto\n";
print MAIL "Subject: ";
print MAIL " :";
print MAIL ": ", $input{'user_name'},"\n";
print MAIL ": ", $input{'phone'},"\n";
close (MAIL);
282 3. Apache, Perl MySQL

$input, -
. , .


Perl . -
,
Java, PHP. Perl -
.

(.regular expressions)
,
. . ,
, , .


. .

, . , -
.
, . ,
, HTML- .
, . -
, HTML- .
, . ,
.

, -
. ,
Perl .

. -
. , //
, , .
, -
, Perl .
.

^ .

$ .
Perl 283

. , .

* .

+ .

? .

x|y x y.

{n}, n . n -
.
{n,}, n . n
. , /x{1,}/ /x+/, /x{0,}/
/x*/.
{n,m}, n m . n
m . , /x{0,1}/ -
/x?/.
[xyz] .

[^xyz] ,
.
[a-z] .

[^a-z] , -
.
\w , .

, /^\w+([\.\w]+)*\w@\w((\.\w)*\w+)*\.\w{2,4}$/ -
, @, -
2 4 (, .ru .info).

, . -
.

I .

M ,
. , ^$
, ,
.
S , -
. , . ,
.
284 3. Apache, Perl MySQL

X . ,
\ , -
. # , .

:
if($email=~ /^\w+([\.\w]+)*\w@\w((\.\w)*\w+)*\.\w{2,4}$/)
{ print " ";}
else
{ print " ";}

,
, , -
:
$_ = ': 12:34:25';
if (/(\d\d):(\d\d):(\d\d)/) {
$hours = $1;
$minutes = $2;
$seconds = $3;
}

$_
.

,
. ,
, , .



.
.

, -
. , ,
? ,
OK.


cookies.
Perl 285

Cookies =, ,
, , .
, -
, , .

-
: HTTP-
cookie Set-cookie.
cookies, Set-
cookie cookie.

cookie,
HTTP_COOKIE :
NAME=VALUE; [expires=DATE;] [path=PATH;] [domain=DOMAIN_NAME;] [secure]

NAME , VALUE . -
. -, ,
.

:
#!d:/Perl/bin/perl.exe

print "Content-type: text/plain; charset=iso-8859-1\nSet-Cookie: cookie-


name=test-value; path=/;\n\n";
print @ENV{'HTTP_COOKIE'};

cookie cookie-name test-value


cookie. @ENV{'HTTP_
COOKIE'} , @ENV{'CONTENT_
LENGTH'}).

cookie? -, -
. -, -
, =, -
cookie .

cookie ,
.
,
. ,
Perl .
286 3. Apache, Perl MySQL

MySQL
MySQL -
(), MySQLAB.

, -
,
, .
, UNIX
-, Windows
, , MacOS.

, ,
: , -
. -
.

MySQL , -
. MySQL
.

,
.

MySQL
, , .
.
.

,
(.3.1).

3.1. Visitors ()

id name () surname () phone () address ()


73 313-48-48 Vasya@pupkin.com
74 7(929)112-14-15 Gena@pupkin.com
75 Ivan_p@yandex.ru

-
. ,
MySQL 287

id , name (), surname (), phone ()


address () .

.
,
.

,
. .

(primary key) , -
. ,
. -
id. , .
surname,
, , , .

.
, -
, ( -
) . -
(,
, ),
(, )
.

, A B, . -
A , -
B.
, A, , -
. B. A -
, B .

. A
B, B
A. , A -
, B . ,
.
288 3. Apache, Perl MySQL


(foreign key) ,
( ,
).
.

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

, , , -
-.
, .
, -
.
, -
, .
,
, .

-
. ,
, ,
. .
MySQL 289

, , -
; , -
, .

,
.

, -
,
( ).

, , -
.
,
. ,
,

. -
.

, . -
.

, MySQL
.

, ,

, -
.

:
, . MySQL
. .

(RESTRICT):
, -
. ,
, .
/ (CASCADE): -

;
290 3. Apache, Perl MySQL


.
.
(SET NULL): -
,
, (NULL).

.

, , ,
, .

MySQL -
. ,
, -
.

.
, ,
.

-
.

. -
, -
(, phpMyAdmin,
-).
.
, , ,
.
. SQL-
.

.
.

MySQL --
. Windows- MySQL - http://dev.mysql.com/
MySQL 291

downloads/ MySQL Community Server. (Windows


Windows x64) :

Essentials ;

ZIP/Setup.EXE , , -
.;
Without installer , (-
). , ,
MySQL.

. -
, ,
No thanks, just take me to the downloads! (, -
, !).

, MySQL
. MySQL
GUI Tools (http://dev.mysql.com/downloads/gui-tools/5.0.html), -
. :

MySQL Administrator , ,
, / MySQL, -
( , .)
;
MySQL Query Browser ,
;
MySQL Migration Toolkit MySQL
(Oracle, Microsoft SQL Server, Microsoft Access,
Sybase .).

, -
, .
.

( ,
Without installer), MySQL5.0.
.

Windows- MySQL , -
.
292 3. Apache, Perl MySQL

1. (Setup Wizard):
MySQL,
mysql-essential-5.0.xxx-win32.msi;
MySQL, -
Setup.exe , .
2. (.3.12) Next ().

. 3.12.

3. (.3.13):
Typical () MySQL:
.
, ;
Complete () MySQL,
;
Custom () ,
MySQL, , .
4. , , -
. -
, Back ().
, Install ().
5. .
Next ().
MySQL 293

. 3.13.

6. ,
Configure the MySQL Server now ( MySQL ).
Finish ().

MySQL (.3.14). Standard Confi


guration.

. 3.14.

, MySQL ,
(.3.15).
294 3. Apache, Perl MySQL

. 3.15.

, -
, MySQL, . -
MySQL -
,
. -,
, .

, , -
(.3.16).

. 3.16.
MySQL 295

GUITools
Complete (.3.17).

. 3.17. MySQL Tools

. MySQL Administrator,
Server Host localhost ( IP--
), -
root ,
MySQL (.3.18).

,
(.3.19).

-
MySQL, -
,
.

root . 3.18.
, .
( ,
, cmd
OK),

mysqladmin u root password <>


296 3. Apache, Perl MySQL

( C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqladmin


u root password <>, bin
Path ) -
Enter.

. 3.19. MySQL

, root,
, p:

mysqladmin u root p password < >

Enter password ( ) -
Enter.

MySQL ,
.

1. Windows.
2.
mysql h < > u < > p
( < > , )
Enter. Enter password
( ) .
MySQL 297

MySQL, -
, (localhost) , :
mysql u root p
mysql>
(.3.20).

. 3.20. MySQL

: ,
, .

, exit
Enter.

MySQL
MySQL Query Browser, .
,
(.3.21).

MySQL , , . -
, , -
( ,
..).
298 3. Apache, Perl MySQL

, , . ,
:
. ,

.
.

. 3.21. MySQL Query Browser

SQL-: ,
,
SQL-,
MySQL ( , ).

, SQL-
.
Enter. ,

SET NAMES cp866;


.3.22 .
MySQL 299

. 3.22.


. , CP-866
( Windows).

,
. ,
.

SHOW DATABASES , -
MySQL. (.3.23).

. 3.23.
300 3. Apache, Perl MySQL

CREATE DATABASE < >;

CREATE DATABASE MySite;

MySite.

, -

DROP DATABASE < >;

:
, , .

USE < >;

, -
.

MySQL .

INFORMATION_SCHEMA , -
.
mysql , MySQL.
,
.
test , ,
.

. , ,
3.1.

3.1.
CREATE TABLE < >
(< 1> < 1> [< 1>],
< 2> < 2> [< 2>],
...
MySQL 301

[< >])
[< >];

.
( 3.1 -
).
, ;
.

: Customers (), Products ()


Orders ().

3.2 Customers.

3.2. Customers
CREATE TABLE Customers
(id SERIAL,
name VARCHAR(100),
phone VARCHAR(20),
address VARCHAR(150),
PRIMARY KEY (id))
CHARACTER SET utf8;

, . -,
, -, ,
. .

id . SERIAL, -
. SERIAL
BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
,
(BIGINT) (UNSIGNED) ,
(NOT
NULL UNIQUE).
, MySQL
(AUTO_INCREMENT). , .
Name , phone address . -
VARCHAR, -
.
.
302 3. Apache, Perl MySQL

-, , id ,
PRIMARY KEY (id).

, . , -
.
ALTER TABLE ,
.

: ,

, :
, .

INSERT [INTO] < >


[(< >)]
VALUES
(< 1>),
(< 2>),
...
(< N>);

INSERT :

, ;

, ( -
, ).

, -
. ,
, MySQL
.

. -

,
, . -
.
MySQL 303

,
. .
.
YYYY-MM-DD HH:MM:SS.

,
NULL (
).

DEFAULT , -
( ).

:
INSERT INTO Customers (nqme, phnone, address)
VALUES
(' ',
'555-33-12'
'-, 56'),
(' ,
NULL,
', 56');

, , UPDATE,
:
UPDATE < >
SET < 1>=< 1>,
...,
< N>=< N>
[WHERE < >]
[ORDER BY < > [ASC DESC]]
[LIMIT < >];

, ,
-

UPDATE Customers SET phone='444-25-27' WHERE id=536;

, ID ( ,
).
304 3. Apache, Perl MySQL

UPDATE.

.
SET < 1>=< 1>, ..., < -
N>=<N>
. , -
. , -
UPDATE Customers SET rating=rating*2;
WHERE < > . -
, .
,
.
ORDER BY < > [ASC DESC] ,
.
. -
.
. , -
(. ), , -
, ,
.
LIMIT < > -
, UPDATE. -
. ,
, ,
.

.
SQL- SELECT:
SELECT * FROM < >;

,
SELECT * FROM Customers;

,
. , ,
,
SELECT name, phone, rating FROM Customers;
MySQL 305

, , -
. ,
SELECT name, phone, rating/1000 FROM CUSTOMERS;

, , -
1000.

. ,
,
SELECT phones FROM Customers;

, .

, .
,
DISTINCT:
SELECT DISTINCT rating FROM Customers;

-
,
ORDER BY < > [ASC DESC]

ASC , -
, DESC .

WHERE.
, UPDATE.
SQL, AND
OR . ,
SELECT name,phone,rating FROM Customers
WHERE name LIKE '%' OR rating>1000
ORDER BY rating DESC;

, , ,
1000, .
% .

SQL
,
- (, , .).
306 3. Apache, Perl MySQL

SQL-: , -
, .
SQL- UPDATE DELETE, , -
, INSERT UPDATE .

,
. <, >, =, <>, !=,
, :

SELECT name,phone,rating1,rating2 FROM Customers


WHERE rating1 > rating2 and name != ``

, ,
, , -
.

, -
.

LIKE .
:

% -
;
_
.

, ,
:

SELECT * FROM Customers WHERE name LIKE '%"%"%';

,
, ,
(\%, \_).
,
(\\).

LIKE -
.
BINARY (COLLATE). , ''
LIKE '' , '' LIKE BINARY '' '-
' LIKE '' COLLATE utf8_bin .
MySQL 307

MySQL Perl
, , Apache, Perl SQL, -
.

Perl MySQL, -
ActivePerl. (44CMD)
:

ppm install DBI


ppm install DBD-mysql

- ,
:

ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd

, ,
Apache, Perl MySQL, .

, http://www.denwer.
ru/. , .


, .
.

1. (.3.24) .

. 3.24.

2. Internet Explorer -
(.3.25). .
3. (.3.26). -

.
308 3. Apache, Perl MySQL

. 3.25.

. 3.26.

4. :
(.3.27) (.3.28).

MySQL 309

. 3.27.

. 3.28.

, -
.
5. ,
:
(.3.29).
310 3. Apache, Perl MySQL

. 3.29.

6. (.3.30).

. 3.30.

7. , , http://localhost/
(.3.31).
MySQL 311

. 3.31.

, .3.31, , -
. , Skype. -
, Skype
80 443 (..3.30). , ,
Apache, .
Apache ( Apache) -
.

, ,
(.3.32).

SQL Perl
, Perl MySQL,
:

my $dsn = "DBI:MYSQL:test:localhost";
my $dbh = DBI->connect($dsn, "username", "password") ||
die "[err]: MySQL: $!";

: -,
. -, MySQL
312 3. Apache, Perl MySQL

. 3.32. Z

, ,
.

Perl
Select:
my $sth = $dbh->prepare(qq{select name, phone, id from users});
$sth->execute();
while (my ($name, $phone, $id) =
sth->fetchrow_array()) #
{
print "$id - $name, $phone <br>";
}
$sth->finish();

prepare
execute. -
fetch_row -
. name, phone ID.

UPDATE, INSERT .
.
313

, :
$dbh->do("insert into users (name, phone) values ('', '111-22-33')");

- :
my $dsn = "DBI:MYSQL:mysite:localhost";
my $dbh = DBI->connect($dsn, "username", "password") ||
die "[err]: MySQL: $!";
my $sth = $dbh->prepare(qq{select title, body from articles where id=$id});
$sth->execute();
(my ($title, $body) = sth->fetchrow_array());
$sth->finish();
Print "<html><body><title>$title</title>";
print <<HTML;
//
HTML
Print $body;
print <<HTML;
//
HTML

,
. :
HTML-.

C , :
(id) .
.

http://www.mysite.ru/article.cgi?id=15. -
, , .
Perl .

,
. ,
,
, , MySQL.
314 3. Apache, Perl MySQL

, ,
. , ,
.

, Perl MySQL
. , -
, , -
. ,
, , Perl
MySQL.
4




(CMS) Joomla! Drupal
CMS Joomla!
CMS Drupal

316 4. (CMS)

,
, . .
, ,
. , -
. -
, .
, :
, -
. , -
CMS (.Content Manager Site,
).

CMS , ,
. -
HTML JavaScript,
, .

, , CMS. -
-
.

, .
, , -
.
-
. CMS, ,
, -
, ,
,
, .
.
CMS. Joomla!
Drupal. .

CMS Joomla!
XXI. GPL
Mambo. 2005.
Joomla!.
CMS Joomla! 317

,
. -
, , ,
.

Joomla!.

-,
Windows, Linux, MacOS, Free BSD .
, Joomla!
PHP, , , .
, Joomla! -, -
PHP.
.

MySQL.

. , -
.
-
, , -
.
, -
, , .
-
.
,
.
,
.

Joomla!.

Joomla! .

, .

, , , -
, .
318 4. (CMS)

PHP 4.3.10;
MySQL;
XML;
zlib;

,
.

1. joomla.
2. Joomla_1.5.5-Stable-Full_Package.tar.bz2.
3. joomla. Joomla_
1.5.5-Stable-Full_Package.tar.bz2 .
7-Zip Windows tar UNIX-
.
dir ( ls )
:
L:\home\localhost\www\joomla>dir /B
administrator
cache
CHANGELOG.php
components
configuration.php-dist
COPYRIGHT.php
CREDITS.php
htaccess.txt
images
includes
index.php
index2.php
INSTALL.php
installation
CMS Joomla! 319

language
libraries
LICENSE.php
LICENSES.php
logs
media
modules
plugins
robots.txt
templates
tmp
xmlrpc
sdsad
4. http://localhost/joomla -
Joomla! (.4.1).
, .

. 4.1. 1.

. -
. ,
. Joomla! .
320 4. (CMS)

5. ,
Joomla!.
Joomla! (.4.2).

. 4.2.

PHP >= 4.3.10 PHP , Joomla!


.
zlib , , -
, -
()
gzip.
XML
AJAX, .
MySQL MySQL ,
Joomla! ; -
, .
configuration.php
Joomla! .
.
CMS Joomla! 321

- -

. .
Joomla! ,
, .
- , -
,
.
6. (.4.3) ,
GNU/GPL. -
, . .

. 4.3. GNU/GPL

7. , Joomla!
(.4.4).
, Joomla! . -
MySQL.
MySQL .
MySQL. MySQL
.
322 4. (CMS)

. 4.4. MySQL

IP- , -
MySQL (, ).
,
,
.
,
MySQL , .

:


, ;
-
, ,
old_;
, ;
Joomla!.
,
CMS Joomla! 323

Joomla! -
. ,
. -
jos_.
MySQL -
.
8. FTP (.4.5).

. 4.5. FTP

UNIX- (Linux, Free BSD .)


, , Joomla!.
, Joomla! -
. , -
Joomla! O Windows.
FTP .
9. (.4.6).
.
. -
e-mail E-mail ,
324 4. (CMS)

Joomla!
. , -
.

. 4.6.

-/ -
. , -
. ,
-. , -
- (.4.7).
.
,
.
10. , -
( ),
( ) (.4.8).

Joomla!, installation
, . -
, installation ,
.
.
CMS Joomla! 325

. 4.7. -

. 4.8.
326 4. (CMS)


,
administrator
. , http://
localhost/joomla, http://
localhost/joomla/administrator. -
. -
-
(.4.9).

. 4.9.

1. Username admin (
).
2. Password , Joomla!
.
3. Language
. . -
.
CMS Joomla! 327

Login -
(.4.10).

. 4.10.

:
( ), -
().
, Site4Control Panel (4 -
).

, -
, .
1.5.5, 1.5.4.
.

.-
,
.
328 4. (CMS)

1. ru-RU_Joomla_1.5.4_site.zip.
2. ru-RU.


ru-RU,
, -
.

3. ru-RU Joomla!, language


( en-GB).

1. ru-RU_Joomla_1.5.4_admin.zip.
2. ru-RU.
3. ru-RU Joomla!, administrator/
language ( en-GB).
4. ,
Language Russian (CIS).
5. , Login.

,
.
.

1. .
2. Extensions4Language Manager (4
).
3. Site () -
Russian (CIS).
4. Default ( ) ,
Default ( ) -
.
5. Administrator ( ).
6. ( , .3 4).
7. , Logout
().
CMS Joomla! 329

, -
.
, , ,
-, .
,
. , , ,
.
.
, .

, Joomla!.


, , Joomla! -
.
.

1.
, .
2. 4 -
(.4.11).

. 4.11.
330 4. (CMS)

Joomla! ,
, , .
, ,
PHP.

, CMS Joomla!.

Super Administrator ,
.
. Joomla!
admin, . , -
. -
admin.
Administrator , -
Super Administrator. ,
:
4 ;

Super Administrator;

Manager ,
. :
;

Super Administrator -
.
Registered ,
, - ,
.
Author () , Registered,
,
. , -
,
.
CMS Joomla! 331

Editor , ,
( ).
Publisher , , -
Editor, -
.

.
Registered.
, .

1.
Super Administrator.
2. 4 , -
.
3. (.4.12).

. 4.12.

4.
.
332 4. (CMS)

, -
.
, . -
, ,
. , -
. , , -
. -
Joomla!
.
(..4.12). -
, .
, ( ,
, ) -
.
.
, -
.
5. ,
.
.


,
. , , Joomla!
. , http://localhost/joomla/index.
php?option=com_sample , -
com_sample.

CMS Joomla! .
, -, ,
. -
.
, ,
.

1. 4/ -
(.4.13).
CMS Joomla! 333

. 4.13.

2. zip-, -
, -
.
3. &
, .
4. , ,
( ) -
.
5. ,
URL. URL ,
, .

, .
-
4 . ,
.

, , (,
).
334 4. (CMS)

, .
.

1. administrator Joomla! .
components, -
.
2. Joomla!, components -
.

Joomla1.5 ,
. ,
, 4 , -
System Legacy . .

1. 4/.
2. , -
.4.14.

. 4.14.

3. ,
.
4. .
CMS Joomla! 335

-
. .

1. , -
.
2. ,
(..4.14).


, -
Joomla!.
. -
,
.
. ,
. -
-
, , .

, PHP JavaScript.
, -
, . -
, ,
, .
: , .

:
. ,
.
.
, .
. -
, , xml-, . -
.

Joomla!
, , . -
, .
,
.
336 4. (CMS)

, .

-
4
(.4.15).

. 4.15.

, -
.
(..4.15).


(.4.16).

. 4.16.

( , -
, ).
.
CMS Joomla! 337

; -
Copy of, .
.

. -
,
.
.


, .
, .

.
, .
.

. -
:
(Public) ;

Registered () -
;
Special ()
Author () .
. -
, ( ).
, .

, . , -
,
.
ID ,
. Joomla!, -
, . .
338 4. (CMS)


(.4.17).

. 4.17.

, .

, .

, .

.
.
. {loadposition xxx}, xxx
, .
, {loadposition xxx},
.
CMS Joomla! 339


, -
, tp=1 -
. , http://
localhost/joomla ,
. : http://localhost/
joomla?tp=1. , -
, .

.
, ( ) -
. ,
,
.
ID .
. .
, .

, -
. .

, -
. .
.
mod_mainmenu,
. ,
.
.
,
.
-
. .
, .
, -
. ,
. -
, , Ctrl
.

.
.
340 4. (CMS)

, -
.

, . -
. :
, , , -
. -
, , Joomla!,
-.


(CSS), html-,
php-, .
, : , , ,
. -
-
, ,
. Joomla!
: beez, JA_Purity rhuk_milkyway. -
, .
( -
). , -
.

1. . http://
localhost/joomla. (.4.18).
2. . http://
localhost/joomla/administartor.
3. 4 . ,
.4.19.
4. , rhuk_milkyway -
(..4.19): .
-
.
5. .
6. ,
.
CMS Joomla! 341

. 4.18. rhuk_milkyway

. 4.19.
342 4. (CMS)

7. . , ,
(.4.20) (..4.18),
(, .) .

. 4.20. beez

, ,
.


(, ) ,
, .
,
. ,
, ( -
, ). -
HTML. Joomla! 1.5
.

. ,
.
CMS Joomla! 343

1. .
2. 4 .
3. , .
4. -
.
. ,
.4.21.

. 4.21.

.
, .

, .

. -
.
.
. :
php, xml. php- -
, xml- ,
.
344 4. (CMS)

,
.
-
.
.

, ,
. ,
xml- .

, CMS Joomla! ,
-
.
, - .

CMS Drupal
Drupal, Joomla!, ,
GPL. Joomla!, CMS Drupal
MySQL, - PostgreSQL.
(Dries Buytaert) 2000.
. -
.
Drupal.ru. CMS -
. Joomla!, Drupal ,
, ,
, API Drupal. -
,
. Drupal API -
, , Joomla!.

,
:

PHP 4.3.3 ;

-;

MySQL PostgreSQL.

, . -
.
CMS Drupal 345

1. drupal-6.3.tar.gz Drupal.ru.
2. ( , drupal)
.
3. http://localhost/drupal, -
(.4.22).

. 4.22. Drupal

4. Install Drupal in English ( Drupal ).


, -
, settings.php, Drupal.
, , .
,
Drupal ( , Y:\home\localhost\www\drupal\). -

cd Y:\home\localhost\www\drupal\sites\default,

copy nul settings.php.
settings.php. -
.
UNIX- settings.php
.
440, chmod 440. -
, .
346 4. (CMS)

5. (.4.23) .
MySQL drp ( MySQL
phpMyApdmin). Database name
drp , Database username
root, Database password . -
, , ,
Dropal,
Advanced options Database host, Database port Table
prefix. , . -
Save and continue.

. 4.23.

6. (.4.24 4.25)
.
:
Site name ;

Site e-mail address ,


.
CMS Drupal 347

. 4.24.

Administrator account :
Username, Password Confirm password ,
;
E-mail address ,
,
.
Server settings , -
.
Default time zone ,
.
, .
Clean URLs , .
, :
GET ( ) POST.
348 4. (CMS)

. 4.25.

Update notifications , -
Drupal. : ,
,
- Drupal.
.
, , .
Save and
continue.
7. (.4.26) ,
Drupal .
http://localhost/drupal. your new site
.

, Drupal , Joomla!.
, .
CMS Drupal 349

,
. , Joomla! ,
Drupal ,
(
).

. 4.26.


, CMS
Drupal.

Drupal already installed (Drupal


), , -
, .htaccess, ,
ExpiresActive Off.

, , , ,
Drupal. .htaccess php
value memory limit 32M. 32M
350 4. (CMS)

, PHP.
.

1. ( http://localhost/drupal).
2. Username () admin, Password (-
) , .
3. Log in ().

,
,
. .

, CMS Drupal
.
, .

1. .
2. Administer4User managment4Users
(.4.27).
:
List ;
Add user .

,
, .

1. Show only users where ( , ) -


permission is () , -
, .
2. status () ,
(active) (blocked) -
.
3. Filter ()
, .
CMS Drupal 351

. 4.27.

(..4.27) -
. :

Username (/ ) ;

Status () ( );

Roles (/) , ;

Member for ( ) ,
;
Last access ( ) , -
;
Operations () ,
.

- ,
. -
.

1. - Show
only users where.
352 4. (CMS)

2.
, .
, -
.
3. Update options ( )
,
:
Unblock the selected users ( ) -
,
active;
Block the selected users ( ) -
, -
blocked;
Delete the selected users ( ) -
.
4. Update () -
.

Username (),
( ,
).

1. .
2. Administer4User managment4Roles (4-
4) -
. Drupal
:
anonymous user ( ) -
;
authenticated user ( )
.
3. edit permissions ( )
, . -
(.4.28).
CMS Drupal 353

. 4.28.

1. .
2. (..4.28),
, -
. , ,
.
3. Save permissions ( )

.

CMS Drupal .
, Joomla!.
,
. modules Drupal.
354 4. (CMS)

Drupal -
, -
.

1. http://localhost/
drupal .
2. .

, ,
, . .

(.4.29) -
By task ( ),
By modules ( ). -
.

. 4.29.

Drupal , Joomla!,
.
, ,
CMS Drupal 355

.
.

1. , http://drupal.org.


dev, -
.

2. .
3. INSTALL.TXT README.TXT,
, .
4. sites/all/modules.
, .
5. Drupal Administer4Site
building4Modules (4 4). -
, (
,
),
(.4.30).
6. Administer4User managment4Permissions (-
44) .
7. , . -
( README.TXT, INSTALL.TXT)
.
Administer4Site configuration4< > (4
4< >).


.
, , -, , -
; -,
Depends on: < > (missing) (). -
, -
Depends on: < > (enabled) ().

, , .
, , , ,
. Drupal -
Joomla!. ,
, .
356 4. (CMS)

. 4.30.

. ,
. Drupal :
.
: , .
, .
, , , ,
.

, .
.

1. Drupal.
2. .
3. Create content ( )
, (.4.31).
CMS Drupal 357

. 4.31.

4. , -
Page ( ) Story (-
) ,
. ,
(.4.32).

, .

Title () ,
.
Body () .
, HTML- . Split summary at cursor -
. -
, ,
- (, ).
Menu settings ( ) ,
. -
(.4.33).
358 4. (CMS)

. 4.32.

. 4.33.

.
Menu link title ( ) ,
.
Parent item ( )
, . -
.
Weight () . ,
. ,
.
CMS Drupal 359

Input format ( ) -
(.4.34).

. 4.34.

.
Filtered HTML ( HTML)
( Body) , ,
. ,
, ,
.
Full HTML ( HTML) . ,
, .
HTML- .
Comment settings ()
(.4.35).

. 4.35.

.
Disabled () .
Read only ( ) -
.
Read/Write (/)
.
Authoring information () .
360 4. (CMS)

Publishing options () .
.
Published () ,
.
Promoted to front page ( ) ,
.
Sticky at top of lists ( ) -
, .

. ,
. ,
, .
. , Drupal, -
. http://www.wikipedia.org/
.

(. +)
.

Drupal . -
.

1. .
2. Administer4Site building4Menus4Navigation (-
4 44) -
, .4.36.
, -
:
Menu item ( ) ;
Enabled () , ;
Expanded () ,
;
Operations () , -
:
Edit () ;
Reset () ;
Delete () .
CMS Drupal 361

. 4.36.

3. ,
Edit () ,
Add Item ( )
.

-
,
(.4.37).

Menu settings .

Path () , .
:
Drupal, node/add;

URL;

<front> .

,
. , , ,
, <front>.
Menu link title ( ) .

Description () .
362 4. (CMS)

. 4.37.

Enabled () ,
.
Expanded () ,
.
Parent item ( ) ,
.
Weight () . ,
( ).


-
Joomla! Drupal. , , .
, . -
363

,
Joomla! -
.
. Drupal ,
PHP, JavaScript , -
. CMS
, , -
, -.
5


PHP

6
PHP

PHP


PHP
PHP

PHP

PHP

PHP 365


PHP

Hypertext

Preprocessor
,
. PHP -

Perl
,
Java

C
. , -
, PHP
(-), -.

PHP

-.


PHP


HTML
- -, -
. PHP


HTML

- . -
, , ,
,
, -.

PHP . -

PHP

, -
.

,
PHP
. ,

Apache

MySQL.
PHP
.
,
.


PHP
.
, PHP

,
, , ,
MySQL

, -

cookie
-.
,
. ,
.

PHP
, -
PHP

-
HTML
-.
366 5. PHP6

- ,
Windows
,
PHP
:

<?php
phpinfo

();
?>
htdocs
Apache
, -
, examples,
-. start.php

PHP
.



XAMPP
,
htdocs
, -
. _:\XAMPP. -

Apache

DocumentRoot httpf.conf.
IIS, inetpub//wwwroot.

.
http
://
localhost
/
examples
/
start
.
php.

PHP.

phpinfo() PHP


, . -
, PHP

-
.

. <?php ?> -
PHP

,
, HTML

- -. ,
.
(5.1).

5.1. HTML PHP


<
html>
<
head>
<
title>

PHP
</
title>
<
body>
PHP 367

<
h
1>

PHP

HTML
</
h
1>
<?
php
echo

" !
PHP
-
Web
!";
?>
</
body>
</
html>
hello.php examples.
http
://
localhost
/
ex-
amples
/
hello
.
php, -
(.5.1).

.5.1. PHP HTML

5.1. ,
<h1> , -

HTML
<?php ?> echo . -
echo
PHP
,
-. 5.1 -
:

echo " ";

() -
. . , :
368 5. PHP6

echo "872976";


HTML
, -
HTML

-. ,

e
cho "<b> </b> ";

echo . ,

echo "", "", "PHP";


PHP
. ,
:

echo " ", " ", " PHP ";

, :

echo " : \" ";

, .

PHP


, -
.
, ,
, (
). ,
, .

PHP

, -
. -, /* -
*/, :

<?php
/*

PHP
*/
369

phpinfo

();
?>
,
, .
:
<?php
/*
/*
PHP
*/
*/
phpinfo

();
?>

*/

,
/* */.

,
. // #, :
<?php
//
//
PHP
//
phpinfo

(); #
PHP

PHP
?>

- , .
: -
.

, , . -
, .
PHP

($).
, - :
370 5. PHP6

$message= "



!";
$counter=10;
$amount=3.62;
, ,
, ., . -

PHP

, .
, . -
, :

$temperature="0";
$temperature=$temperature+2;
$temperature, "0" (), -
2. .
, :

$int_variable=(integer)$variable;,
. -
PHP
:

boolean true false;

string

;
integer

;
float

;
object ;

array ;

resourse ;

NULL

.

PHP

, object, -
. object
- -
, .
PHP 371

Boolean
: true ()
false (). -
:
<?
php
$variable = false; //

$variable

false
?>

, -
- -
. ,
<?php
if (
MyFunction
() ==
true
) {
echo "
MyFunction
";
}
?>

if , MyFuction(), ,
true, .

String
.
.

, PHP
,

PHP

. :
<?
php
$
string
= " , ";
echo $
string;
?>

echo string .

Integer
-
32. 2147483648
372 5. PHP6

2147483647. , + -
, .

-
0 (), : $variable=0739.
, -
0x, : $variable=0x837.

Float
float .
,
, 14

.
:
<?
php
$
variable
1 = 1.264;
$variable2 = 1.3e3;
$variable3 = 3E-10;
?>

Array

,
, . ,
- -
.

-, , -
. ,
0 :
<?php
$
array
[0]="";
$
array
[1]="";
$
array
[2]="";
$
array
[3]="";
?>

$array , 0, 1, 2 3 .
PHP 373

, , , -
:

<?php
$
array
[""]="";
$
array
[""]="";
$
array
[""]="";
?>

, -
.

. -
:

$_[_1][_2]..[_N];

, :

<?php
$array[0][0]="";
$array[0][1]="";
$array[1][0]="";
$array[1][1]="";
$array[1][2]="";
$array[2][0]="";
$array[2][1]="";
$array[2][2]="";
?>

, PHP


array(). :

<?php
$array[""] = array(""=>"34", ""=>"", ""=>
"");
$array[""] = array(""=>"44", ""=>"", ""=>
"");
$array[""] = array(""=>"32", ""=>"", ""=>
"");
?>
374 5. PHP6

: ,
. =>
.

Resource
resource ,
. ,
. -
, .

NULL
. ,
. NULL
:

NULL;
- ;
unset().

PHP
- , -

- .. ,
. , , -
, ,

: 3.1415926535. -
pi
define ("pi", 3.1415926535);

pi,
.
, , .

define() :
define (_, , $case_sen);
PHP 375

$case_sen , -
: true ,
false .

5.2 -
pi.

5.2.
<?php
define("pi", 3.1415926535, true);
$r=10;
$
lenght
=2*
pi
*$
r;
echo
" ", $
r
, " ", $
lenght;
$
square
=
pi
*
pow
($
r
, 2);
echo
"<
br
> ", $
r
, " ", $
square;
?>

.5.2.

.5.2.

,
define(),
.

PHP ,
.
376 5. PHP6

, .
defined(), true, .

PHP


PHP
, ,
. -
, :
, -
, , ,
.



= :

_=_;

. ,

<
php?
$
variable
1=5;
$
variable
2=
variable
1;
?>

$variable1 $variable2 5.

-
:

$
var
1=$
var
2=$
var
3=$
var
4=2;


-
.
:
PHP 377

+ ;
- ;
* ;
/ ;
% .

5.3.
5.3.
<?
php
echo
"7 + 3 = " , 7 + 3, "<
br
>";
echo "7 - 3 = ", 7 - 3, "<br>";
echo "7 * 3 = ", 7 * 3, "<br>";
echo "7 / 3 = ", 7 / 3, "<br>";
echo
"7 / 3 = ", 7 % 3, "<
br
>";
?>

.5.3.

.5.3.
PHP

.
, . -
,
378 5. PHP6

.
.



PHP
-
, -
,
. ,
$
variable
+= 21;

$variable 21
$variable, -
:
$
variable
= $
variable
+ 21;

, -
:
$
variable
-=24; // $
variable
24
$variable*=5; //

$variable
5
$variable/=3; //

$variable
3



PHP

(.), , -
, .
:
<?
php
$
variable
1 = " ";
$
variable
2 = $
variable
1 . "!";
?>

$variable2 "
!". -
:
<?php
$variable1 = "

";
PHP 379

$variable1 .= "

!";
?>

$variable1 "!". -
.


1. ,
++$variable $variable 1
$variable, --
$variable $variable 1. -
, , ,
(.).

. -
-
.
, -
.
,
.

5.4 -
.
5.4.
<?php
$var1=$var2=$var3=var4=2;
echo "\$var1++ = ", $var1++, "<br>";
echo "++\$var2 = ", ++$var2, "<br>";
echo "\$var3-- = ", $var3--, "<br>";
echo "--\$var4 = " , --$var4, "<br>";
?>

-
5.4 .5.4.

, -
-
.5.4.
.
380 5. PHP6



1 0.
PHP
32--
. :

0000 0000 0000 0000 0000 0000 0000 0101

5. -
1 0 .
,
, , $var1 $var2,
. -
:

& ( ) var1&var2 ,
$var1, $var2;
| ( ) var1|var2 ,
$var1, $var2;
^ ( ) var1^var2 ,
$var1, $var2;
~ () ~$var1 , $var1
, ;
<< $var1<<$var2 $var1
$var2 ;
>> $var1>>$var2 $var1
$var2 .


,
.
if, -
-
. :

if
(_)

PHP 381

true false, -
. -
if , , if.

, , -
.
, , $x<$y , $x $y.

PHP

:

== () $x==$y , $x $y;
=== () $x===$y , $x
$y ;
!= () $x!=$y , $x $y;
<> () $x<>$y , $x $y;
!== ( ) $x!==$y , $x
$y ;
< () $x<$y , $x $y;
> () $x<$y , $x $y;
<= ( ) $x<=$y , $x
$y;
>= ( ) $x>=$y , $x
$y.

:
<?php
$temperature=26;
if($temperature>=24)
echo "



"

?>

,
.


, -
, . , -
:
382 5. PHP6

if
(__1&&__2)

if , 1,
2. ,
, , ,
, .

PHP

:

AND ( ) $xAND$y , $x, $y -


;
OR ( ) $xOR$y , $x,
$y;
XOR ( ) $xXOR$y ,
$x, $y, ;
! () !$x , $x ;

&& ( ) $x&&$y , $x, $y -


;
|| ( ) $x||$y , $x,
$y.

, AND &&
OR ||. , && ||
. ,
.



PHP
.5.1.
,
.

5.1.


1 = += -= *= /= %= >>= <<== &= ^= |=
2 ||
3 &&
PHP 383


4 |
5 ^
6 &
7 !=
8 <<= >>=
9 << >>
10 +-
11 */%
12 ++ --

PHP

,
.


PHP


.
if, PHP

-
.

if

if :

if (_)
{
1;

2;
}

if , ,
if. ,
. -
:

<?
php
if

($
x
< $
y
) {
384 5. PHP6

echo

"
x

y
";
$
z
=$
y;
$
y
= $
x;
$
x
=$
z;
}
?>

$x $y , $x $y,
$x $y, $y $x, -
.


if
else

, ,
, -
ifelse. :
if (_)
_1;
else
_2;

if
_1, _2.
, :
<?php
if ($x > $y) {
echo "x

y";
$

z
=$
y;
$
y
=$
x;
$
x
=$
z;
}
else
echo "
y

x
";
?>

, ifelse :
if (__1):
__1;
elseif(__2):
__2;
PHP 385

else:
__3;
endif

ifelse -
, . -
elseif, -
if. elseif :
if (__1) {
__1;
} elseif (__2) {
__2;
} else
if
(__3) {
__3;
}

-
, PHP

.

switch


- , , if
switch-case. switch-case
:
switch() {
case __1:
__1;
[break;]
case __2:
__2;
[break;]
. . .
case __N:
__N;
[break;]
386 5. PHP6

[default: ___;
[break]]
}

switch,
_ case.
, case.
_ case
, default.

: case
,
switch, break.

switch-case:

<?
php
switch
($
x
) {
case
0:
case
1:
case 2:
echo "x

3<br>";
break;
case 3:
echo "x=3<br>";
break;
case 4:
echo "x=4<br>";
break;
case 5:
echo "x=5<br>";
break;
case 6:
echo "x

5<br>";
}
?>
PHP 387

, case 0 1 ,
$x 0 1, switch0:
switch1:. switch3:
"x3".



PHP

. -
.
, .

PHP

:

FOR

;
WHILE

;
DOWHILE ;

FOREACH

.


FOR

for .
for :

for (__; _; ___


) {
_;
}

<?php
for(x=2, $i=1; $i<12; i++) {
x +=2;
echo "<br> i = ", $i, " x = ", $x;
}
?>
388 5. PHP6

$i -
$x, ( , -
). -
.

1.
, -
12.
2.
, , -
.
3.
.
4.
1.

,
, -
, .

dowhile

while -
, , for, while .
while :

do {
_;
}
while (_);

, _, ,
, ,
. dowhile:

<?
php
$
i
= 1;
do {
echo "<br> i = ", $i;
}
while
($
i
++<10);
?>

$i -
, 10.
PHP 389

while

:
while (_) {
_
}

while .

1.
.
2.
, ,
.

while:
<?php
$x=0;
while ($x++<12) {
echo "<br> i = ", $i;
}
?>

$i++<12
. ,
. ,
++$i<12, -
, .

foreach
foreach .
:
foreach ( as $=>$) {
_
}

foreach:
<?php
$
fruits
["<"] = "3
USD
";
$
fruits
[""] = "5
USD
";
390 5. PHP6

$
fruits
[""] = "2
USD
";
$
fruits
[""] = "3
USD
";
foreach ($fruits as $key => $value) {
echo "<b>

: ", $key , "

: ", $key;
}
?>

$fruits
$key $value,
.

break

, -
, break. break
break.
:

<?php
$i=1;
while ($i++<9) {
if ($5==3) break;
echo "<b>

", $i";
}
?>

$i 3 .

, .
:

for (...) //
{
for (...) //
{
for (...) //
{
}
}
}
PHP 391

- , -
:
break(_);
1,
, .

continue

continue
. continue
,
.

continue
. -,
- ,
.
continue:
<?php
$
i
=0;
while

($
i
++<15) {
if

($
i
==6)
continue;
echo "<b> $
i
";
}
?>

PHP


PHP
, , ,
, ,
. -
, ,
, .

PHP

. -
, -
.
392 5. PHP6

PHP .

,
.

, , -
. -
, , PHP

.

PHP

:
function
_ (1[=1],...,1[=1])
{
_
}

function,
, . -
.

, ,
. , -
.
, -
.
. .

.
return, , -
. , .

return:
<?php
function user_function() {
$return_value = 666;
return $return_value;
}
PHP 393

$x = user_function();
echo
"<
br
>
x
= ", $
x;
?>

user_function return
666.


,
. , :
<?
php
function

user

_
function
($
x
, $
y
, $
z
) {

}
?>

user_function()
.

. -
(&).
<?php
function user_function(&$string_argument) {
$string_argument .=





.;
}
$
string
= , ;
user_function($string);
echo "<br> string = ", $string;
?>

, .


, -
.
. :
394 5. PHP6

<?php
function sale_fruit($argument = "

") {
return "



$argument";
}
echo "<br>", sale_fruit();
echo "<br>", sale_fruit("

");
?>

, -
. , .


-
.

,
.
-
.


. -
, , , -
.

, :

<?
php
$ = 69;
function user_function() {
$x = 96;
echo

"<
br
>
x
= ", $
x;
}
PHP 395

user_function();
echo
"<
br
>
x
= ", $
x;
?>

x=96

x=69

,
:
global
$
variable
1, $
variable
2. ;
:
<?php
$x = 5;
$y = 4;
function addition() {
global $x, $y, $z;
$z = $x + $y;
}
addition();
echo
"
<br> z = "

, $z;
?>

"z=9".
addition() $x, $y $z
.
, -
.

, PHP

-
. -
, .
, -
:
<?php
function function_counter() {
396 5. PHP6

static $counter;
$counter++;
echo $counter;
}
for ($i = 0; $i++<8;) function_counter();
?>

12345678

11111111

, function_counter()
,
0. -
echo.


,
PHP
. , ,
, PHP

,
. , , , -
,
.


PHP
-
-,
-. :
,
cookie
-,
, -.
6

-
PHP



MySQL

cookie

398 6. - PHP

PHP

-
,
. , ,
-.

PHP

, -
-, ,
. , - -
, -,
-.

, -
-
,
, , -
, .. , -

MySQL
( ),
MySQL

, , -
, -
.


MySQL
PHP

,
, ,
, , .
, . -
MySQL

, -
. , http
://
php
.
su -

PHP
,
.

,
cookie
-
-. -

, .

, -. -
, --
,
PHP
.

-.
399


-, :
(6.1).

6.1. -
<
html>
<head>

<title>

</title>
</head>
<body>
<center>
<h1> </h1>
<form method="post" action="simple_form.php">

<input name="name" type="text">
<br>
<input type=submit value="OK">
</form>
</center>
</body>
</html>

simple_form.html













examples
http://localhost/examples/simple_









,
form.html







(

.6.1).

, HTML

,
OK simple_form.php, -
ACTION , , ,
. ?

PHP
,
.
$_GET $_POST,
GET POST ( , ,
METHOD).
400 6. - PHP

$_REQUEST, . -
(6.2).

6.2.
<html>
<head>
<title>

</title>
</head>
<body>
<center>
<h1> , </h1>



:

<?php
echo $_POST["name"];
?>
</center>
</body>
</html>

simple_form.php









examples,

simple_form.html,
















-


,


(

.

.6.1).

.6.2.

,
.

-
-
. , -
.


, -
: , -
.
-
-. .6.1.
401

,

HTML

. 6.3 , -
6.1 6.2.

.6.2.

6.3. -
<html>
<head>
<title>

</
title>
</
head>
<
body>
<
center>
<?
php
//
if
-
if

(
isset
($_
REQUEST
["
name
"]))
{
?>
<h1> , </h1>
:
<?
php
402 6. - PHP

// 6.2
echo

$_
POST
["
name
"]; }
else
{
?>
// 6.1
<h1>




</h1>
<form method="post" action="simple_form_script.php">






<input name="name" type="text">
<br>
<input type=submit value="OK">
</form>
<?php
}
?>
</center>
</body>
</html>

,
- 6.1, <?php ?> -
HTML

PHP

, . ,
, -
,
if(isset($_REQUEST["name"]))

isset() if
- : , -
false, true.

-,
, $_
PO
ST["name"]
false. else, -
. ,
-, $_
PO
ST["name"]
, , if, -
.
403

, ,
HTML-

HTML
PHP

.
simple_form_script.php examples,
, http
://
localhost
/
examplex
/
simple
_
form
_
script
.
php -
.
.6.1 6.2.

, -
HTML

(6.4).

6.4. -
<
html>
<
head>
<
title>
-
</
title>
</head>
<body>
<center>
<?php
// if -
if(isset($_POST["login"]))

{
?>
<h1>



: </h1>
<?php

//
echo "<br>


: ", $_POST["login"],

"<br>

: ", $_POST["password"],

"<br>



: ", $_POST["preferences"],
"<br> : ", $_POST["sport"],
"<br> : ", $_POST["sportsmen"],
"<br>:",$_POST["message"];
}
else
404 6. - PHP

{
?>
<! !>
<h1>




</h1>

<form method="post" action="complex_form.php">




<input name="login" type="text">
<br><br>

<input name="password" type="password">
<br><br> <br>

<textarea name="preferences" rows="3" cols="30">

1.
2.
3.
</textarea>
<br><br>
<Select name="sport">

<option>

</option>
<option>

</option>
<option>

</option>
</select>
<br><br><br><br> c ?

<input name="sportsmen" type="radio" value="


">

<input name="sportsmen" type="radio" value="

">

<br>

<input name="message" type="checkbox" value="


">
<br><br>
<input type=submit value="OK">
</form>
<?php
}
?>
</center>
405

</body>
</html>

, complex_form.php examples
, http
://
localhost
/
examples
/
complex
_
script
.
php . .6.3.

.6.3. -

, -.
, (.6.4).

. ,
, : $_POST
echo
6.2.

- .
.
406 6. - PHP

.6.4.


- HTML
:

<
input
type

="
file
">

,
ENCTYPE="multipart/form-data" (6.5).

6.5.
<html>
<head>

<title>






</title>
</head>
<body>
<center>
<h1>



</h1>
407

<form
enctype="multipart/form-data"
method="post"
action="form_file.php">






<input name="myfile" type="file">
<br>
<input type=submit value="

">
</form>
</center>
</body>
</html>

form_file.html







examples







(

.6.5).

.6.5.

,
form_file.php (6.6).

6.6.
<html>
<head>
408 6. - PHP

<title>

</title>

</head>
<body>
<center>
<h1>





</h1>
<br>

<?php

$handle=fopen($_FILES["myfile"]["tmp_name"], "r");
while (feof($handle)==0)
{
$file_content=fgets($handle);
echo $file_content, "<br>";
}
fclose($handle);
?>

</center>
</body>
</html>

, . -
tmp_name ,

$_FILE["___ _"]["tmp_name"].

6.5 :
<input name="myfile" type="file">.

,
$_FILES["myfile"]["tmp_name"].

, ,
. -
fopen() c

:
resource fopen ( string filename, string mode)

filename , mode .
409

"r" ,
"w", .
fopen() ,
.

, MyFile.txt, -
examples, . -
- .
6.5 :

$
handle
=
fopen
($_
FILES
["
myfile
"]["
tmp
_
name
"], "
r
");
while (feof($handle)==0)

{
$file_content=fgets($handle);
echo $file_content, "<br>";
}
fclose($handle);

fopen(), , -
$handle .

while ,
fgets().
:

string
fgets

(
resource
handle

[,
int
length

])

handle , length ,
fgets(). , fgets()
length-1 ( ); length
1024. , -
feof(), true false
.

- , .6.6.

, :
. PHP


,
. , -
, . ,
.
410 6. - PHP

.6.6.
MyFile
.
txt


MySQL

.3
MySQL
Perl

.
PHP

: ,
PHP

MySQL

-
.

MySQL


MySQL,

-
, ( )
MySQL

.
, Apache


MySQL
, ,
, .3, XAMMP

. , -
, .3, PHP
.

MySQL

:

resource mysql_connect ([string server [,string username [,string password


[,bool new_link [,int client_flags]]]]] )
MySQL 411

, mysql_connect()
, MySQL

. -
false.

server , .
localhost,
, : /path_to_MySQL_socket
database:3306.
-, . -
MySQL

.

username password , ,
MySQL

. -
, -
MySQL

.

. true
new_link
MySQL

mysql_connect(). ,
.
client_flags , .

mysql_connect() @,
-
. , ,
, . -
-
, .

MySQL

,
mysql_close().

MySQL
:
<?php
$connection = mysql_connect("localhost", "user_MySQL", "password_
MySQL");
If($connection==false)
die("





MySQL: " . mysql_error());
echo
"
MySQL
";
mysql

_
close
($
connection
);
?>
412 6. - PHP


MySQL

die(), . -
,
(.) ,
mysql_error().


MySQL
,
.

bool

mysql
_
select
_
db
( string

__ [,
resource
_-
__
MySQL
] )
true,
false.
MySQL

,
myssql_connect() . -
, MySQL

,
c

MySQL

,
, mysql_
connect().

mysql_select_db() , -
, ,
. PHP


. ,
. ,
www.php.su -
.

MySQL


. mysql_query(),
PHP
MySQL

.





:

resource mysql_query ( string mysql_query [, resource mysql_connection])


false, ,
, true ( -
).

mysql_query , mysql_
connection MySQL

.
MySQL 413

, MySQL

, ,
mysql_connect(). -
, .3.
:

CREATE
DATABASE

IF

NOT

EXIST

db

_
name

db_name . -
, .

, MySQL
:

$mysql_query="CREATE DATABASE IF NOT EXIST my_db"


$result=mysql_query($mysql_query);
If
((!$
result)
die

(" ");

: $mysql_query
my_d
MySQL
b,
mysql_query().
, .

.
, .3. -
, .3
:

CREATE TABLE table_name (column_1, column_2, column_N)

( table_name)
( column_...).

INSERT INTO table_name (column_1, column_2, , column_N) VALUE (value_1,


value_2, , value_N)

value_1, ..., value



_N ,
, .
.

.3, , -
. ,
.6.3 (6.7).
414 6. - PHP

6.7. -
<html>
<head>
<title>
-
</title>
</head>
<body>
<center>
<?php
// if -
if(isset($_POST["login"]))
{
?>
<h1> </h1>
<?
php
//
MySQL
$connection=mysql_connect("localhost", "user", "password");

if
($
connection
==
false)
die

("
MySQL
");
// C





my_db
$query="CREATE DATABASE IF NOT EXISTS my_db";
$result=mysql_query($query);
if($result==false)
die(" ");

// my_db
$my_db=mysql_select_db("my_db", $connection);

if($my_db==false)

die(" ");
//



$query="CREATE TABLE account (login text, password text,
preferences text, sport text, sportsmen text, message text)";
$result=mysql_query($query);
if($result==false)
MySQL 415

die(" ");

//
$login=$_POST["login"];

$password=$_POST["password"];
$preferences=$_POST["preferences"];
$sport=$_POST["sport"];
$sportsmen=$_POST["sportsmen"];
$message=$_POST["message"];
//







$query="INSERT INTO account (login, password, preferences, sport,
sportsmen, message) VALUES ($login, $password, $preferences, $sport,
$sportsmen, $message)";
$result=mysql_query($query);
if($result==false)
die(" ");

//
echo " ";
mysql_close($connection);
}
else
{
?>
<! !>

, .
, ,
.
, .

forma_db.php examples --
, http://localhost/examples/forma_db.php
. -
,
. , ? -
:

SELECT name_1, name_2, name_N FROM name_table


416 6. - PHP

name_... name_table.
, PHP

,
(6.8).
6.8. -
<
html>
<
head>
<
title>
-
</title>

</head>
<body>
<center>
<h1> </h1>
<?php
// MySQL
$connection=mysql_connect("localhost", "user", "password");
if
($
connection
==
false)
die

("
MySQL
");
// C my_db
$query="CREATE DATABASE IF NOT EXISTS my_db";
$result=mysql_query($query);
if($result==false)
die
(" ");
//
my
_
db
$my_db=mysql_select_db("my_db", $connection);

if
($
my
_
db
==
false)
die

(" ");
//



$query="SELECT * FROM account";
$result=mysql_query($query);
if($result==false)
die
(" ");
//
echo

" ";
$account=mysql_fetch_array($result);

echo "<br> : ", $account[login],
MySQL 417

"<br> : ", $account[password],


"<br> : ", $account[preferences],
"<

br
> : ", $
account
[
sport
],
"<
br
> : ", $
account
[
sportsmen
],
"<
br
> : ", $
account
[
message
];

mysql_close($connection);

?>
</center>
</body>
</
html>

$
query
="
SELECT
*
FROM
account

";

PHP
:

$
result
=
mysql
_
query
($
query
);

mysql_fetch_array() -
, ,
.
(.6.7).

.6.7.
418 6. - PHP

, MySQL

PHP

,
, , .
. -
PHP

, ,
-.


-, , ,
. -
, -
, ,
cookie
-. -
.

-
, , -
. , - ,
..
$_SESSION. , :
$_
SESSION
[
background
]="";

, -
. -
, ,
cookie
-,
.

session_start(),
. $_SESSION,
, --
. 6.9
.
,
, -
$_SESSION.
6.9.
<?php
session_start();
419

?>
<
html>
<
head>
<
title
> </
title>
</
head>
<
body>
<center>
<h1> </h1>
<?php

if(isset($_SESSION[counter])==false)
$_SESSION[counter]=0;
$_SESSION[counter]++;
echo "





", $_SESSION[counter], "

";
?>

</center>
</body>
</html>

. (-
, F5)
session_start(0), ,
, . .6.8
.

.6.8.
420 6. - PHP

, :
,
$_SESSION. unset(). ,
:

session_start();
unset($_SESSION[counter];

, ,
, .
, session_id(),
:

string session_id ([string id])

,
id, .
session_id() ,
session_start().
az
Z
,A 09.

cookie

-. -
PHP

-
, PHPSESSID.
,
cookie
,
PHP
.
,
cookie
- .

cookie


cookie
,
.
,
- ,
.
, cookie


HTTP
-, ,
HTML

, HTTP

HTML

- .
cookie 421

- setcookie(),
cookie

:
int setcookie (string name [, string value [, int expire [, string path [,
string domain [, int secure]]]]])

name
, value . -
cookie
"".
:

expire cookie
;
path , cookie

;
domain , cookie
;
secure
cookie
-
.

, cookie

, -
cookie

(6.10).
6.10.
cookie
<?
php
setcookie

("
color
", "
green
");
?>
<html>
<head>
<title>

cookie </title>
</head>
<body>
<center>
<h1>

cookie</h1>
cookie

. <a href="read_cookie.php">
</a>
</
center>
</
body>
</
html>

"color" "green",
cookie

read_cookie.php, -
. cookie.
php examples. cookie

(6.11).
422 6. - PHP

6.11.
cookie
<html>
<head>

<title>

cookie </title>
</head>
<body>
<center>
<h1>

cookie </h1>
<?php
if(isset($_COOKIE[color])!=false)
echo "cookie



", $_COOKIE[color];
else
echo

"
cookie
";
?>
</
center>
</
body>
</html>

cookie

$_COOKIE -
. read_
cookie.php examples , localhost/
examples/cookie.php .
(.6.9, ) 6.11. -
.6.9, .

.6.9. () ()
cookie
423

6.11,
cookie

$_COOKIE. -
cookie.php? ,
-, .

, setcookie()
cookie

, , "" -
value. , 6.10
c
ookie
, :
setcookie
("
color
", "");

cookie
, :
setcookie("cookie[1]", "color");
setcookie("cookie[2]", "data");
setcookie
("
cookie
[3]", "
time
");

$_COOKIE["cookie"],
.

, cookie

,
-,
cookie
. , -
- ,
cookie
.

, PHP

,
. , -
, , .



. php.ini,
php.ini:
[mail function]
;For Win32 only.
smtp=localhost
; For Win32 only.
sendmail
_
from
=
me
@
example
.
com
424 6. - PHP

smtp
, sendmail_from
SMTP
.
, -.
, -

SMTP
POP

3. -

XAMPP
, -

Mercury
XAMPP

.
,
, postmaster@localhost.

mail(),
PHP

:
bool mail (string to, string subject, string message [, string additional_
headers [, string additional_parameters]])

to , subject ,
message . -
(additional_headers)
(additional_parameters).

mail() true
false (,
).

6.12 -,
, .
6.12. -
<html>
<head>
<title>
-
</title
</head>
<body>
<center>
<?php
// if -
if(isset($_POST["lb"]))

{
425

?>
<h1>



</h1>
<?php
if(!mail($_POST["to"], $_POST["subject"], $_POST["message"]))
echo " ";

else
echo " ";
}
else
{
?>
<h1> </h1>
<form method="post" action="mail.php">



: <input name="to" type="text"> <br>


: <input name="subject" type="text"> <br>
<textarea name="preferences" rows="5" cols="40"> </textarea>
<br>
<input name="lb" type="hidden" value="Yes"><br>
<input type="submit" value="

">
</form>
<?php
}
?>
</
center>
</
body>
</
html>

, .
:

<input name="lb" type="hidden" value="Yes">

lb
:

if(isset($_POST["lb"]))

426 6. - PHP

$lb , -
else if,
.
, Yes, mail(),
$_POST.

,
. ,

,
, .


,
PHP
,
.5. -, -
,
MySQL


PHP
,

cookie
-. -
,
, -.


PHP
. -
(
Ajax
), -

, , .
,
-, .
Ajax

, -
- , -
,
.
7

AJAX

AJAX
XML
MySQL

428 7. AJAX

-, -
PHP

. , ,
, PHP .
, -
-, ,
, : -
( , . usability , ,
), , .

- , --
(, Apache

), , -
. , -
.
, , -
. , ,
, -
. -
.

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

,
(
-,
, , ).
- , -
, -
, .

-,
, -
AJAX

,
Asynchronous
JavaScript

and

XML
( JavaScript

XML

). .
AJAX 429

AJAX


AJAX
, ,
, . ,
-, AJAX

,
. , -
, , -
. , ,
( ), , -
, ,
.

?
,
AJAX
. , , -
,
, ,
.

. -
, -
AJAX
,
. -:
- , ,
, , - ,
, , .. ,
AJAX


. ,
, ( ) -
.
AJAX
? !
, ,
,
AJAX

.
, .

. ,
AJAX
(
Yahoo
,
Google
), -
.


AJAX
? -, ,
JavaScript
XML

. JavaScript

.3 ,
XML
-
.
430 7. AJAX

XML


XML
eXtensible

Markup

Language

,
.
, WWW.

XML
? HTML

, .1,

. - -
,
.
, , , , ,
,
HTML.

W

3
C

HTML
, .
:

HTML
,
,
.
XML
.


XML
, -
, , ,
.
XML
-
DTD

(
Document
Type

Definition

),

XML
-, . -

XML
-,
DTD
.

, .
XML
, , ,
XML.

<?XML version="1.0"
.
?>
<hello>
<title>



XML</title>
<
body
>
XML
-</
body>
</
hello>

,

XML
1.0. ? ,
AJAX 431

,
. (?) -
, <? ?>.

,
HTML.
, -
.
DDT
,

XML
.
DTD

XML
:
<!ELEMENT HELLO (TITLE, BODY)>
<!ELEMENT TITLE (#PCDATA)>
<!
ELEMENT
BODY

(#
PCDATA
)>

, XML

-
HELLO, TITLE BODY. TITLE BODY
HELLO #PCDATA.


XML
DTD

-
DOCTYPE. , -
, ,
DTD.

hello.dtd.

DTD
XML
:
<?XML version="1.0"?>
<!DOCTYPE HELLO SYSTEM "hello.dtd">
<hello>
<
title
>
XML
</
title>
<
body
>
XML
-</
body>
</
hello>

<!DOKTYPE DTD hello.


dtd, SYSTEM , ,
( -
PUBLIC).


DTD
XML

, -
:
<?XML version=1.0"?>
<!DOCTYPE HELLO [
<!ELEMENT HELLO (TITLE, BODY)>
432 7. AJAX

<!ELEMENT TITLE (#PCDATA)>


<!ELEMENT BODY (#PCDATA)>
]>
<hello>
<title>



XML</title>
<body>



XML-

</body>
</hello>

, XML
-
. , , (
HELLO) .

TITLE BODY, DTD

-
. -
, , -
.
XML

,
AJAX
.

-
AJAX
.

- AJAX

examples ajax.html
c

HTML
(7.1).
7.1. -
AJAX
<html>
<head>
<title>

AJAX</title>
<script type="text/javascript" src="ajax.js"></script>
</head>
<body onload=request()>
Enter your login:
<input type="text" id="myLogin" />
<div id="Message" />
</body>
</html>
AJAX 433

, JavaScript

,
ajax.js (7.2). ,
JavaScript

AJAX

.

7.2.
AJAX
if(window.ActiveXObject)
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else
var xmlHttp = new XMLHttpRequest();
if (!xmlHttp)
alert("Error creating the XMLHttpRequest object.");
function request() {
if (xmlHttp.readyState == 4 || xmlHttp.status == 0) {
name = document.all("myLogin").value;
xmlHttp.open("GET", "ajax.php?login=" + name, true);
xmlHttp.onreadystatechange = ResponseHandler;
xmlHttp.send(null);
}
else
setTimeout(request(), 1000);
}
function ResponseHandler() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
Response = xmlDocumentElement.firstChild.data;
document.all("Message").innerHTML =
<i>+Response+</i>;
setTimeout(request(), 1000);
}
else {
alert(" ");
} } }

434 7. AJAX

examples ajax.js. -
examples ajax.php

PHP
(7.3).

7.3.
<?
php
header
(
Content
-
Type
:
text
/
xml
);
echo <?xml version="1.0" ?>;
echo <response>;
$login = $_GET[login];
$userNames = array(PETYA, SERGEY, IVAN, MASHA, LENA);
if (in_array(strtoupper($login), $userNames))
echo Hello, user . $login . !;
else if (trim($login) == )
echo Empty login;
else
echo $login, , - unregistered user;
echo </response>;
?>

ajax.html,

localhost/examples/ajax.html

-
Enter your login





.

. -
,
(.7.1).

, -
,
.
, ,

.
-
, -
Unregistered user (-
). , -
.7.1.
,
(.7.2). AJAX
AJAX 435

, --
.
HTML
7.1
Java
Script
, 7.2.

HTML
--
Java
Script
, 7.2:
if(window.ActiveXObject)
var xmlHttp = new ActiveXObject("Microsoft.
XMLHTTP");
.7.2.
else
var xmlHttp = new XMLHttpRequest();
if (!xmlHttp)
alert("Error creating the XMLHttpRequest object.");

XMLHttpRequest, -

AJAX
. , ,
ActiveObject(), XMLHttpRequest().
XMLHttpRequest xmlHttp -
, -
.

HTML

7.1:
<
body
onload

=
request
()>

, request() -
ajax.js:

function request() {
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
name = document.all("myLogin").value;
xmlHttp.open("GET", "ajax.php?login=" + name, true);
xmlHttp.onreadystatechange = ResponseHandler;
xmlHttp.send(null);
}
else
setTimeout(request(), 1000);
}
436 7. AJAX

:
AJAX
-
.
XMLHttpRequest. -
readyState, :

0 ;

1 ;

2 ;

3 ;

4 .

, , ,
. -
setTimeout()
request():

setTimeout
(
request
(), 1000);

all -
AJAX

MyLogin HTML

, , -
:

name = document.all("myLogin").value;

open XMLHttpRequest -
PHP
:

xmlHttp.open("GET", "ajax.php?login=" + name, true);

"
ajax
.
php
?
login
=" +
name

, HTML
.
, ,
true.

AJAX

:
, , -

. :

xmlHttp
.
onreadystatechange
=
ResponseHandler
;
AJAX 437

o n r e a d y s t a t e c h a n g e
XMLHttpRequest ResponseHandler().

. s e n d ( )

AJAX
XMLHttpRequest:
xmlHttp
.
send
(
null
);

PHP

(. 7.3).
XML

-:
header(Content-Type: text/xml);
echo <?xml version="1.0" ?>;

, , -
xml. , -

XML
,
:
echo
<
response
>;


xml. , ,
http://localhost/ajax.
PHP
php?login=

XML

.7.3.

.7.3.
XML

-

$
login
= $_
GET
[
login
];
438 7. AJAX

$userNames,
in_array(), , ,
PHP

echo

Hello
,
user
. $
login
. !;

, .
, -
, .
, trim()
trim($login) ,
. ,
(.7.4).

.7.4.

, , (.7.5).

.7.5.

xml,
?
:
AJAX 439

function
ResponseHandler

() {
if

(
xmlHttp
.
readyState
== 4) {
if (xmlHttp.status == 200)

{
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
Response = xmlDocumentElement.firstChild.data;
document.all("Message").innerHTML=<i>+Response+</i>;
setTimeout(request(), 1000);
}
else {
alert(" ");
} } }



AJAX
.
readyState
XMLHttpRequest:
if
(
xmlHttp
.
readyState
== 4)

, status
XMLHttpRequest:
if
(
xmlHttp
.
status
== 200)

200 .
,
XML
-
, .
XMLHttpRequest:

xmlHttp.responseXML XML;
xmlDocumentElement = xmlResponse.documentElement
XML
;
xmlDocumentElement.firstChild.data -
XML
.

XMLHttpRequest
XML
, .

Response,
:
<i>+Response+</i>
440 7. AJAX

<div id="Message" />.

, -,
AJAX
.

ajax.html
1. c

AJAX

.
request() AJAX
2. .
request() XMLHttpRequest -
3.
.
XMLHttpRequest , 1-
4.
request().

c
, request() AJAX
5.
AJAX
:
-
;
ResponseHandler() AJAX
.
request() .
6.
7.
PHP

-
XML
.
8.
-
ResponseHandler().
, ResponseHandler() -
XML

.
,
(..7.4).
, -
(..7.3).
,
(..7.5).
request() 1-
9.
. .

, XMLHttpRequest
, . - -
, -
XML 441

XMLHttpRequest ,
. -
AJAX

,
. -
, .


xml. ,

AJAX,
, -
. XML

,
, -, , -
, , , -
AJAX

. .

XML

, ,
xml. (7.4).
7.4.
XML
<?xml version="1.0" ?>
<response>
<users>
<user>
<name>
Petia
</name>
<age>
25
</age>
</user>
<user>
<name>
Vasia
</name>
<age>
20
</age>
442 7. AJAX

</user>
</users>
</response>

users.xml









example.

,
<user></user>, <name></
name> <age></age>.

HTML

- (7.5).
7.5.
<html>
<head>
<title> XML</title>
<script type="text/javascript" src="users.js"></script>

</

head>
<
body
onload

="
request
()">
, ?
<br/>

<div id="DivOutput" />
</body>
</html>

<div id="DivOutput" />,


,
. users.html examples.

,
JavaScript
(-
7.6).
7.6.
if(window.ActiveXObject)
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

else
var xmlHttp = new XMLHttpRequest();
function request() {
if (xmlHttp)
{
//







try
XML 443

{
xmlHttp.open("GET", "http://localhost/examples/users.xml", true);
xmlHttp.onreadystatechange = ResponseHandler;
xmlHttp.send(null);
}
//













catch (e)

{
alert(" ");
}
}
}
// - AJAX
function ResponseHandler() {
if (xmlHttp.readyState == 4)

{
if (xmlHttp.status == 200)
{
var xmlResponse = xmlHttp.responseXML;
xmlRoot = xmlResponse.documentElement;
nameArray = xmlRoot.getElementsByTagName("name");
ageArray = xmlRoot.getElementsByTagName("age");
var html = "";
for (var i=0; i<nameArray.length; i++)
html += "<b>

: "+ nameArray.item(i).firstChild.data +
",

: " + ageArray.item(i).firstChild.data + "</b><br/>";
myDiv = document.all("DivOutput");
myDiv.innerHTML = "<i>



-



: </i><br />" + html;
}
else
{
alert(" ");
}
}
}

users.js examples.
444 7. AJAX

, localhost/examples/

HTML
users.html . , -
.7.6.

.7.6.

, users.js.
XMLHttpRequest , .
,
request(), .

XMLHttpRequest,
-
try/catch,
JavaScript
.
( ) . -
try/catch :
try
{
,
}
catch
{
,
}

.
, ,

.
MySQL 445

request() :

AJAX
, , -
XML
:
xmlHttp.open("GET", "users.xml", true);

,
ResponseHandler().
, XML
.

, . -
,
XML
:
var
xmlResponse

=
xmlHttp
.
responseXML;

xmlResponse, -
. XML

-
:
xmlRoot
=
xmlResponse
.
documentElement;

XMLHttpRequest -
:
nameArray = xmlRoot.getElementsByTagName("name");
ageArray = xmlRoot.getElementsByTagName("age");

,
<div>
.

, -
PHP

:
.

-
. ,
MySQL.
, AJAX
.

MySQL


MySQL
,

PHP
,
446 7. AJAX


MySQL

XML

. -

AJAX
, . - -

AJAX
. 7.1 7.2,
,
PHP
,
MySQL
.


MySQL
, -
, 7.3 $UserNames:
PETYA, SERGEY, IVAN, MASHA, LENA.
MySQL
MySQL

, -
.3. users, UsrLogin.

-. -
(7.7).
7.7.
<html>
<head>

<title>

AJAX</title>
<script type="text/javascript" src="mysql.js"></script>
</head>
<body onload=request()>
Enter your login:
<input type="text" id="myLogin" />
<div id="Message" />
</body>
</html>

mysql.html examples.
JavaScript
MySQL

.
7.2 -
(7.8).
7.8.
if(window.ActiveXObject)
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
else
var xmlHttp = new XMLHttpRequest();
if (!xmlHttp)
MySQL 447

alert("Error creating the XMLHttpRequest object.");


function request() {
if (xmlHttp)
{
//







try
{
name = document.all("myLogin").value;
xmlHttp.open("GET", "mysql.php?login=" + name, true);
xmlHttp.onreadystatechange = ResponseHandler;
xmlHttp.send(null);
}
//













catch (e)

{
alert(" ");
}
}
}
function ResponseHandler() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
Response = xmlDocumentElement.firstChild.data;
document.all("Message").innerHTML =
<i> + Response + </
i>;
setTimeout(request(), 1000);
}
else {
alert("







");
}
}
}
448 7. AJAX

, , try/catch
. mysql.js
example.

PHP

MySQL

(7.9).
7.9.
MySQL
<?php
require_once(handle_err.php);
header(Content-Type: text/xml);
echo <?xml version="1.0" ?>;
echo <response>;
$login = $_GET[login];
$connection=mysql_connect(localhost", user", password");
$my_db=mysql_select_db(users", $connection);
$query="SELECT * FROM UsrLogin";
$result=mysql_query($query);
$userNames=mysql_fetch_array($result);
if (in_array(strtoupper($login), $userNames))
echo Hello, user . htmlentities($login) . !;
else if (trim($login) == )
echo Empty login;
else
echo htmlentities($login) . , Unregistered user;
echo </response>;
?>

mysql.php example
,
require_once(handle_err.php);

handle_err.php

PHP
(7.10).
example.

7.10.




<?php
set_error_handler(handle_err);
function handle_err($errNo, $errStr, $errFile, $errLine)
MySQL 449

{
if(ob_get_length()) ob_clean();
$message =



: . $errNo .
: . $

errStr.
: .
$errFile .
,

. $errLine;
echo $message;
exit;
}
?>

mysql.html, localhost/
examples/mysql.html ,
, .7.1 7.2.
MySQL

. , -
, -
, . --
, AJAX


PHP
MySQL

, . , ,
, -
AJAX

. -
,
,
AJAX


.

, PHP

. -
7.9 MySQL

,
users UsrLogin
c

:

$
query
="
SELECT
*
FROM
UsrLogin

";


7.3. ,
, , , , -
XML
.

-
, 7.10.
450 7. AJAX

set_error_handler() -
:

set
_
error
_
handler
(
handle
_
err
);

handle_err .
: ($
errNo), ($
errStr),
errFile), ($
, ($ errLine):

function handle_err($errNo, $errStr, $errFile, $errLine)

ob_clean() ,
,
.
exit, -
. , ,
.

, -

.
,
-.


,
AJAX
, -
,
XML
-
XML

.
try/
catch JavaScript

-
PHP

. , -,
AJAX

, MySQL

, -
, .


AJAX

.
, ,
, , -,
, , -
Google

Earth
.
8

452 8.

, ,
, -
. , , ,
. , ,
-
, , . :
.

, ,
, , , . -
, ,
HTML- HTML-,
.

Microsoft Word, -
, , HTML-.
HTML-
4 (Tools4Spelling) F7.

,
.

, - - -
-. ,
, Internet Explorer, Mozilla Firefox
Opera. - -
: 800600, 1024768 12801024,
.

, -
,
.


-.
, , ,
. ,
, .
, .
453

, -, , -
.

? !
, -
, -
Web Link Validator.

Web Link Validator ,


. - -
, , .
,
100000.
.

Web Link Validator


Web Link Validator
, . Web Link Validator
(.8.1), , Toolbar ( ) -
, .

. 8.1. Web Link Validator

URL,
URL- , . -
, -
, , .
454 8.

, ,
,
.

Web Link Validator .

Link List ( ) ,
HTML- URL- -
. , ,
, (Favorites).
Web Site Verification ( -)
.

Web Link Validator


View (),
.

, , -
.
Link List ( ).


Web Link Validator ,
. ,
Link List ( )
.

1. View4Link List (4 )
F5. ,
Link List ( ) (..8.1).
Switch to link verification
mode ( ) Toolbar ( -
). ,
.
2. URL -,
.


- /.
455

3. Add (),
URL. (.8.2).

. 8.2.

4. .
Link List ( )
(Favorites) Internet Explorer
, .
5. Bookmarks () Toolbar ( )
All Favorite/Bookmarks ( /
) Shift+Ctrl+A. , -
,
.
-
. -
Total ().


-,
, -
Bookmarks ()
Internet Explorer Favorites ( Internet Explorer), Netscape Navigator/
Mozilla Firefox Bookmarks ( Netscape Navigator/ Mozilla Firefox)
Opera Bookmarks ( Opera).

,
.
6. Select All ( ) Toolbar ( -
). .
456 8.


, -
, , -
Ctrl. , Delete ()
Toolbar ( ).

7. Verify () Toolbar ( ).
, -
.

, Stop ()
Toolbar ( ).

, -
/. ,
, , , -
.

, ,
(.8.3).

. 8.3.
457

, ,
. :

Error ();

URL (URL-);

Comment ();

Size ( );

Verification Time ( );

Date Verified ( );

Date Modified ( );

Content Type ( );

Redirected to ().

.
.
. , -
, ,
.

, Save ()
Toolbar ( ).
, Open () Toolbar
( ), , , .

Link List ( ).
, , -
. , Web Link
Validator Web Site Verification ( -)
.

-
, Web Link
Validator . -
Web Site Verification ( -).
, .

1. View4Web Site Verification (4 -)


F6, .
458 8.

Switch to Web site


verification mode ( -) Toolbar
( ).
Web Site Verification ( -) (.8.4) Toolbar
( ) , -
. URL, -
.
.

. 8.4. Web Link Validator Web Site Verification


( -)

2. New () Toolbar ( )
Qiuck Start ( ).
Qiuck Start ( ), URL-
(.8.5).

. 8.5. Qiuck Start ( )


459

3. Enter starting URL ( URL) --


, , http://www.
relsoftware.com/.
4. Retrieve links from the specified page only (
).
, .


Verify external links ( ),
, .

5. Start (), .
, -
Web Site Verification Process (
-) (.8.6).

. 8.6. Web Site Verification Process ( -)

Verification
progress ( ).
,
:
(Verified);
(Ignored);
460 8.

(Added). ,
.
URL- -
.
, Stop ().
6. , Web Site Verification
Process ( -), Close ().

(.8.7).

. 8.7.

, ,
, .

, :
All links ( );
Good links ( );
Broken links ( );
Non verified links ( );
461

Unsupported links ( );
Aborted links ( );
Internal links ( );
External links ( );
Pages processed ( );
Redirected links ( );
Found in HTML Tags ( HTML-);
Protocols (, );
Filename Extension ( );
File groups ( );
Directory tree ( ).
,
.
:
General () ;
Children () URL, --
. , ,
, ;
Parents () -,
URL;
Bad Bookmarks () ,
.
,
Properties () Toolbar (-
).
General () -
:
Status ();
Title ();
Redirected to ();
Content Type ( );
Data Modified ( );
Verification time ( );
462 8.

Size ();

Download Size ( );

HTML Tag (HTML-);

Level ();

Internal ();

Processed ();

Aborted ().

, -
, - .
Properties (
) Toolbar ( ), Parents
().

,
Save () Toolbar ( ).

, -
, , -
, Open () Toolbar ( -
), Start ().

. -
,
Copy (). Link List ( ),
, Verify ().

- HTML, --
, .
New () Toolbar ( -
) Quick Start ( ),
Open (),
. index.html.

Web Link Validator


. -
: ,
- .
- 4050 .
HTML-, , , , ,
- 463

. -
, ,
. ,
? -. -
.

-
,
-, . HTML-
. ,
-.
HTML-,
. HTML-.

HTML- -
, Advanced HTML Optimizer.

Advanced HTML Optimizer HTML--


, . -
- , .
HTML-
.
, , -
.
HTML- .

Windows
Advanced HTML Optimizer,
.

Advanced HTML Optimizer (.8.8)


Toolbar ( ), -
. -
Statusbar ( ),
.
File(s) to compress (() )
.

-,
. .
464 8.

. 8.8. Advanced HTML Optimizer

1. Add Files ( ) Toolbar ( -


). Add File(s) ( ())
(.8.9).
.

. 8.9. Add File(s) ( ())

2. HTML-, ,
(Open), Add File(s) ( ()).
File(s) to compress (() )
(.8.10).
- 465

. 8.10.

:
Name () ;

Type () ;

Path () ;

Date () ;

Size () ;

Packed () ;

Saved () -
;
Ratio () -
.
-
.
, -
HTML-. Add Folder (-
) Toolbar ( ).

, . -
.

1. Optimize () Toolbar ( -
). Compress () (.8.11).
466 8.

. 8.11. Compress ()

,
.
Backup,
, .
C:\Program Files\Advanced HTML Optimizer\Backup.
2. Compress (), OK.
Overall
compressing performance ( ) (.8.12).

. 8.12. Overall compressing performance ( )

-
:
Optimized () ;

Elapsed time ( ) ;

Source size ( ) ;
- 467

Packed Size ( ) ;

Saved () -
.
3. Overall compressing performance (
), OK. -
File(s) to compress (() ) (.8.13).
, -
Backup. ,
Backup () Options () -
.
, -
. Options
() , Options ()
Toolbar ( ).

. 8.13.


. ,
.

1. Restore () Toolbar ( -
). Confirm () -
.
468 8.

2. Yes (), .
, File(s)
to compress (() ).

, STRONG B, STRIKE S;

(CR), ;

(LF);

Optimization () Options ()
: ,
, ,
, CR LF, .
Edit4Options (4-
). Options ()
F9.

- Advanced
HTML Optimizer. , -
-,
.


.
-, ,
Web Link Validator.
, -, ,
Advanced HTML Optimizer.

, .
? ?
.
9

470 9.

. ,
, . !
- , -
-, .

:
,
.
HTTP HyperText Transfer Protocol ( ),
-
.

.
,
.


, -
-
. , -
.
, -
-

. ,
.

, ,
. -
. .
,
.

,
,
.


, , , , ,
471

.

.

, -
.
, .

, , , , -
. 512
20 .
. , -
-
.

, .
- .
,
, , ,
.


. , ,
.
.

,
, .

- MHost.ru 5 15 -
.
: PHP-, -
, .
, , -
, . www.mchost.
ru. .9.1 MHost.ru.
472 9.

. 9.1. - MHost.ru

- , -
.
- www.hc.ru. .9.2
- .

- -
. ,
-
. , ,
. - ,
, ,
. .

. ,
.

Eomy.net ( www.eomy.net) -
. ,
473

. 9.2. -

300 30 /
. PHP, SSI Perl.
,
. -
, .

Ayola.net ( www.ayola.net)
. ,
, 500 -
, , , PHP,
MySQL .

Jino-Net.ru ( www.jino-net.ru) -

.
70 -
PHP5, MySQL, SSI FTP.
.
474 9.

,
. -
.


, -
. ,
-
-
.


;
;


10.

, . .
.

1. http://jino.ru/.
(.9.3).
2. , -
-.
(.9.4).
3. : , .
, , -
.
475

. 9.3.

4. , -
, : ,
.
5. ,

.
6.
.
7. . -
(.9.5).


, -
. , ,
.

, . -
.
476 9.

. 9.4.

. 9.5.
477

, -
(.9.6).

. 9.6.

, ,
;
, -
: ( ), FTP-, -
, MySQL,
;
,
;
,
;
478 9.

, , ,
;
.

, -
. , . -
.

1. .
.
2.
. -
(.9.7).

. 9.7.

3. / , ,
.

( ) ( -
).

,
. ,
479

. ,
- , -
.

,
, . -
, .


, -
.

1.
. -
(.9.8).

. 9.8.

,
, , , -
, .

.
,
. domains. -
, .
480 9.

1.
domains, . .
2. .
, , .
3. ,
.
.
4. .
. , -
.
5. .
domains.

,
. .


, ,
.
,
,
. , -

. , ,
, ,
.

, , ,
. , -
. , -
.
10

482 10.

-
. ,
. ,
.

,
, .
, -
. :


;
( -
).

,
.
. , -
, , , ,
:
.

, -
, , , ,
.
, -
. -
, , .
,
, - (
).

, .
.
. -
. , -
,
.
.
.
483


? :

-
-
;

.

:
, .
,
, . ,
.

, -
. ?
.


,
, -
.


, - . , -
.

. ,
. -
.

, , , , . -
() -
.
. ,
, -
, .
484 10.

,
. -
.
,
. ,
. ?
?

, , -
.
. ( -
, ) ,
( 510). -
,
, ..

,
, - .
.
,
.

, -
, -. -
-, ,
, , -
,
. - HTML- <head>
</head> :
<head>
<title></title>
<meta http-equiv="autor" content=" ">
<meta http-equiv="KEYWORDS" content=" ">
<meta http-equiv="DESCRIPTION" content=" ">
</head>

- . ,
,
. , .
, , , .
485

HTML-, ,
, -
. -
- .


, , -
, . -
, , -
, ,
. -
, , , . -
, -
.

, , -
, .
, , -
-, ,
.
, .

,
: , ,
. ,

. -
, .

content - 1024, -
. ,
. , -
, -
, . . -
, - -
.

-.
,
.
.
.
486 10.


<title> </title> 256. -
, .
256,
6080 , -
.
.

,
, , . ,
-
. ,
. , -
, , ,
, .

-
, .

- .
.
, ,
. ,
. -
, . , -
,
.

? -
,
.
, 98%
. , -
, , ( ).
,
- .


Rambler, ndex . , -
. ,
.
487

Rambler (http://www.rambler.ru/) , -
, ,
.
, .

, Rambler -,
. -
, ,
.., .
,
.

-
,
. -
, .
http://www.rambler.ru/doc/add_site_form.shtml.
.10.1.

. 10.1. Rambler
488 10.

ndex (http://www.ya.ru/) ,
. ,
, , ,
.
, ,
. - , -
- .
-
. -
http://www.yandex.ru/addurl.html.

(http://www.aport.ru/)
. ,
, , , ,
. .
http://www.aport.ru/addurl.php.

Eprst (http://www.eprst.ru/).
,
, . http://
lovers.eprst.ru/reg/index.php3.

,
Russia on the Net (http://www.ru/rus/index.html) Yahoo!
(http://www.yahoo.com/).


. , AltaVista, HotBot, GoTo.com., Google
, , -
, .
, . -
,
; -. -
,
.

AltaVista (http://www.altavista.com/) (.10.2), ,


,
.
. -
- .
489

. 10.2. AltaVista

GO.com (http://www.go.com/) ,
MP3- .
, -
. .
.

HotBot (http://www.hotbot.com/)
, .
, .

Google (http://www.google.com/) -
, .

,
, Lycos (http://www.lycos.com/), MSN
(http://www.msn.com/), AOL (http://www.aol.com/) Nothern Light (http://www.
nothernlight.com/).

, -
.
, , .
490 10.

, ,
.

,

. , AddWeb (http://www.cyberspacehq.com/) Register
Pro Promotion Spider (http://www.sharewarejunkies.com/9zwd11/register_pro.htm)

. , ,
. -
, -
, .

-
, .
.
, .
, . , -
, , ,
.


-
, . -
. , -
,
- . ,
, . -, -
, , .
-
. ,
, . .
, :
, . ,
, ,
.

, ,
. , ,
491

. -
, -
, URL . ,
, -
, .
, -
.
13 .

,
, -
( 1000 ) . ,
,
, . ,
- ,
( ).

,
,
,
.
, .
, .
.

, ? -
()
.

(http://catalog.aport.ru/rus/thememap.aspx) -
.
. ,
, , , -
, , ,
.

, . , -
- , , ,
, . -
http://www.aport.ru/addurl.php,
.10.3.
492 10.

. 10.3.

Mail.ru (http://list.mail.ru/index.html)
(.10.4).

, -,
.
, . -
, -
. ,
, ,
, .

-
. ,
http://list.mail.ru/registration/reg-advice.html.

Russia on the Net (http://www.ru/) (.10.5) -


, . ,
,
.

, .
Russia on the Net
493

. 10.4. Mail.ru

, . -
http://www.ru/rus/index.add.php4.

UP.ru (http://www.up.ru/) (.10.6) , -


.
http://top.rate.ru/register.html.

Chat.ru (http://catalog.chat.ru/) .
http://www.chat.ru/rulez.html.

(http://go.km.ru/);

(http://www.ulitka.ru/);

(http://www.susanin.net/);

Data.ru (http://www.data.ru/).
494 10.

. 10.5. Russia on the Net

. 10.6. Up.ru
495

. -
, .
, . .
, -
. .
,
.

, -
, .
.

, -
, -
, . -
.
100, Mail.ru, SpyLOG .

, -
, , . , -
, .
- .
,
, .
, .
, , . -
, , -
, .

.
, -
, -
. ,
: -
, , ,
.
.
496 10.

-
, . ,
,
. , -
, , -
.

, , ,
.
. -
, , , -
. ,
, . -
, Rambler 60
, . , -
,
.

100 (http://www.rambler.ru/).

.
, -
, . ,
Rambler .

Rambler 50,
20 . ,
1000

50 . -
, .
. -
30.

, , , -
, , -
. , -

. 20-
497

,
.
.

,
, , , -
, .
, . ,
, -
, ,
.. -
,
,
.
, ,
.

,
.
, , -
, .

,
, .
: 8888 -
8831 Rambler.
. -
, , -
. Rambler
. Rambler, -
.10.7, http://www.rambler.ru/doc/add_site.shtml.

Mail.ru (http://top.mail.ru/) (.10.8) ,


Rambler . , -
,
.

.
. ,
,
( ). ,
498 10.

. 10.7. Rambler

. 10.8. Mail.ru
499

, . -
,
Java- ( 1,5, -
).
,
. , ,
Rambler, .
http://top.mail.ru/add.

SpyLOG (http://spylog.ru/), , -
.
. -
: , , -
, -
, .
http://stats.spylog.ru/add.phtml (.10.9).

. 10.9. SpyLOG
500 10.

,
. ,
;
.
.
. , -
, -
, , -.
,
.
. , -
, -
, .
, .
,
.
, .
-
.



. . ,
.
, : 57% -
. -
, . -

.

,
.

. , ,
, ,
.
501

, , -
. -
, , -
, .

. ,
100 ,
90 .
.
, , . , -
.
.


-
, , CTR
. -
,
,
(, -
), -
, - . -

, ,
.

,
-
. , , , ,
, , . -
, -
. , ,
, -
.
.
,
.

, ,
GIF JPEG, - -
. ,
502 10.

. ,
,
. 46860,
40050, 12060, 100100 8831. -
, .

,
( ). , , 46860 -
1015.

. -
. ,
, , -
, (
). , ,
.

. -
.
, ,
(CTR Click True Ratio) 0,2 3,5%, CTR 0,7%.
, 1% 100 -
.

? ,
, -
. , -
. -
1%.
3% . , ,
. , , -
, .

, -
.
, . ,
, , .
, ,
. -
. ,
.
503

, -
, -
, , , -
, . ,
,
- ,
.
, .
-
.


. .

Russian Link Exchange (http://www.rle.ru) (.10.10) 20000-


, 19
46860. ,
.
14 33%. -
, .

. ,
400 .

RB2 (http://www.rb2.design.ru) , -
100100 .
. RB2 , -
,
. , -
, . RB2 -
,
. -
20000 .
, .

(http://www.interreklama.ru) , -
. -
10%. , -
.
.
46860 .
504 10.

. 10.10. Russian Link Exchange

,
http://webrating.ru.


,
. , ,
, -
.

, -
, 46860 . , ,
, , -
.
,
. 8831-
, . ,
. -
505

-. ,
. , -
.

. -
.


,
,
, ,
.

, ,
.
, . -
,
.

.
, . -
: ,
, .

, -
, .

.

CGI-.


CGI- , -
. ,
. CGI (Common Gateway Interface) -
, -
.

,
.
506 10.

, , (
, ).
, -
-.

,
, , ,
. ,
, , -
, .

, -
, , , ,
.


CGI-.
http://www.download.ru/.
, -
, -

. -
, .
, : -,
; -, -
, .
, GuestBook.ru (http://www.
guestbook.ru/) Chat.ru (http://www.chat.ru/).


, , , -
, .
, -
, ,
. , -
,

507

.
.

, -
, -
. , ,
: -
. ,
.
, -
. -
, . ,
23 .

-
:

WebForum.ru (http://www.webforum.ru);

@mail.ru (http://talk.mail.ru).

.
CGI-
, ,
. ,
, .
-
.
,
,
.


. ,
-:

Chat.ru (http://www.chat.ru);

chats.RU (http://www.chats.ru);

. (http://www.narod.ru).
508 10.

, , , -
, . ,
.
,
, , .


, -
, -
. ,
. ,
,
, - .
, , .
, ,
, . , -
,
. ,
-
.

, ,
, . -
, -
.
( )
. , .
, -
,
.

.
, -
.
. CGI- -
. , ,
:
, ,
. ,
509

, -
.

, -
, , . -
,
, , , -
, .. ,
, . ,
, -
.

-
, . -

.
.
,
. , ,
.

, -
, , , -
, ..

, ,

. -
,
. , -, -
, -, --
. , -

.

, . -
, ,
. . -
, ,
510 10.

. , ,
. -
. -

, : 1020
80 . , -
, -
. ,
, .

( 200300),
, . ,
, (
15).
, ,
, -
( ) -
. ,
, .

- , -
.
, -
.

. ,

.

. , -
, ,
, -
. -
, -
.

: ,
, -
. -
.
511

, , ,
, ,
.

, ,
.

. -
,
.
. ,
. -
-, .

. -. -
, ,
..
,
.
, -
, . -
- ,
- .
, -
- (,
).
-,
.
-. - -
, ,
, .
. ,
, -
.

,
, - -
.
512 10.



. , , -
, -
. -
, , .
-
. -
, , .

, ,
, .
, ,
- ,
. .