Académique Documents
Professionnel Documents
Culture Documents
.
.
.
.
. , .
.
32.988.02-018
004.72
25
. .
- 100 %: HTML, CSS, JavaScript, PHP, CMS, AJAX, .
.: , 2010. 512 .: . ( 100%).
ISBN 978-5-49807-826-7
. .
, , , . , ,
, .
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
262
4.
(CMS) Joomla! Drupal . . . . . . . .
315
5. PHP6 . . . . . .
364
6. - PHP . . . . . . . . . . . . . . . . . . . . . . . . .
397
7. AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
427
8. . . . . . . . . . . . . . . . . . . . .
451
9. . . . . . . . . . . . . . . . . . . .
469
10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
481
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
, . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1. HTML CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
12
12
12
12
13
13
13
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
262
263
263
264
267
270
270
274
Perl . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. .
. . . . . . . . . . . . . .
SQL-: , .
, . . . . . . . . . . . . . . . . . . . . . . . . .
: , .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MySQL Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
SQL Perl . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.
(CMS) Joomla! Drupal . . . . . . . . .
CMS Joomla! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMS Drupal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5. PHP6 . . . . . .
278
282
284
286
286
290
298
302
305
307
307
311
313
315
316
318
326
327
329
332
335
340
342
344
345
349
350
362
364
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Integer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Float . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6. - PHP . . . . . . . . . . . . . . . . . . . . . . . . .
370
371
371
371
372
372
374
374
374
376
376
376
378
378
379
380
380
381
382
383
385
387
391
392
393
393
394
396
397
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
MySQL . . . . . . . . . . . . . . . . . . 410
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
cookie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
7. AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AJAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- AJAX . . . . . . . . . . . . . . . . . . . . . .
XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Web Link Validator . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9. . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
427
429
430
432
441
445
450
451
452
453
454
457
463
468
469
470
471
474
479
480
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
,
, .
:
;
,
(, ,
, , , , ..);
, ,
, ,
. ,
,
.
. , .
, .
, , .
,
.
.
,
.
,
AlexanderZhadaev@sigmaplus.mcdir.ru www.sigmaplus.mcdir.ru (
, ).
,
dgurski@minsk.piter.com ( , ).
!
( ) http://www.piter.com/download.
http://www.piter.com
.
13
HTML CSS
HTML
HTML-
CSS
CSS
CSS
HTML
, HTML -.
HTML-, CSS.
HTML
(HTML
HiperText Markup Language). , , , HTML-,
.
HTML- , . .
HTML . , .
- .
<>. , : </>.
, .
. , , .
: , .
<P>, : <P> </P>, , . <IMG>,
.
, , . , , .
15
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-
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-;
17
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-
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>.
, ,
.
19
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-
. 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
21
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-
, , ,
.
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
[RFC850]
Pragma
no-cache
, ,
,
Refresh
( )
( ), URL
de
el
en
en-GB
en-US
en-cockney
es
fr
it
i-navajo
ja
he
Content-Language
23
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
text/css
CSS
Content-Style-Type
.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-
.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" />
25
26
1. HTML CSS
, , . . ,
: ,
. 200250, keyword, .
.
,
, . , , , , , .
, , . , , .
Robots .
1.7 ,
, .
.1.5 ,
.
1.5. content Robots
Index
Noindex
Follow
Nofollow
All
None
URL,
www.test.ru.
HTML-
, <META> : .
, ,
, .
<STYLE>
, .
.
, , ,
,
<STYLE>.
(CSS) , HTML-
. ,
, HTML- .
, , , , HTML-,
.
<STYLE> CSS.
, TYPE MIME-: text/css.
- , CLASS
,
.
,
.
. , .
,
.
,
MEDIA.
MEDIA :
print ;
screen ;
all .
27
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-
</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
.
29
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-
. 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 . .
31
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-
, .
.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.
33
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-
,
. , 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/. ,
35
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-
<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>, .
37
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" />
<title> BODY</title>
</head>
<body topmargin="10" leftmargin="20" bottommargin="10">
</body>
</html>
10, 20.
<BODY> , .
TEXT . ,
.
SCROLL , . Yes No, , ,
. , , , ,
.
<BODY>. ,
, .
, , . .
. . ,
.
<!-- -->. , , .
HTML-,
.
, ,
<BODY>. , : ,
39
40
1. HTML CSS
, .
HTML :
,
, , . , .
, . ,
.
, .
HTML ,
. ,
.
HTML .
, .
<H1>, <H2>, <H3>, <H4>, <H5> <H6>.
.
, .
ALIGN.
ALIGN :
left ;
right ;
center ;
justify ( ).
TITLE, ( , ).
1.17
.
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.
41
42
1. HTML CSS
,
. HTML
.
HTML <P>,
. , ,
: , , <P>.
. HTML.
<P> , , ALIGN.
.
ALIGN .
center . -
, .
,
;
left .
, . , ;
right .
, . . ;
justify .
,
. :
.
, ,
.
TITLE, .
1.18 .
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 />,
.
43
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>, .
, ,
,
. <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.
45
46
1. HTML CSS
.1.8,
, .
, ,
.
, HTML .
. ( ),
..
HTML , :
;
;
.
,
. , , .
.
HTML <UL>. , <UL>.
<LI>.
<UL> TYPE, .
TYPE :
circle , ;
square ;
disc .
, , .
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.
47
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.23 .
1.23.
<html>
<head>
<title></title>
<body>
<ul>
<img src="marker.jpg" /><br />
. 1.10.
. 1.11.
. ,
? , . ,
.
, ,
, .
<OL>,
. .
<OL> TYPE, ,
.
TYPE :
A ;
a ;
I ;
i ;
1 .
<OL> START, , .
49
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>
</ol>
<ol type="i">
<li> </li>
<li> </li>
<li> </li>
<li> </li>
<li> </li>
</ol>
</body>
</html>
.1.12 1.24 .
. 1.12.
,
6.
51
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.
, , .
.
: ,
.
,
, , .
<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>
53
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>
<ul>
<li> </li>
<li> </li>
</ul>
</li>
<li> </li>
</ol>
</body>
</html>
. 1.15 ,
.
. 1.15.
, .
. , , .
.
, , .
,
.
: .
. .
, .
, , -
.
URL- ,
.
55
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. ,
. ,
.
. 1.17.
57
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>
.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. -
59
60
1. HTML CSS
. , .
. , .
? , . , , ,
.
, HTML .
.
: . .
, , . , .
,
. ,
, -
.
,
, . ,
,
, , .
.
,
, .
. .
, ,
.
.
,
,
, , .
<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>
61
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 ). .
:
<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> . .
63
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.
, ,
.
.
,
.
<B>
<B> .
:
<b> </b>
<I>
<I> .
:
<i></i>
<TT>
<TT> .
:
<tt> </tt>
<U>
<U> .
:
<u></u>
<S>
<S> .
:
<s></s>
65
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> ,
.
.
:
<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.
, ,
.
67
68
1. HTML CSS
. 1.21.
, . ,
.
.1.7 , .
1.7.
B
I
TT
U
S, STRIKE
BIG
SMALL
SUB
SUP
STRONG
EM, DFN, VAR, CITE
CODE, SAMP, KBD
INS
DEL
,
, .
. , .
, , . , .
, .
<FONT>
<FONT> . ,
.
<FONT> , ,
.
FACE, .
, . , FACE.
SIZE.
(, 2 6). 3.
. +,
, ,
, . , .
COLOR. , , #RRGGBB. HTML-
.
1.34
<FONT>.
1.34. <FONT>
<html>
<head>
<title> FONT</title>
<body>
69
70
1. HTML CSS
. 1.22. <FONT>
, . , , .
<DIV>
<DIV> . ,
<DIV> STYLE, CLASS.
HTML :
ALIGN
TITLE.
1.35
<DIV>.
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>
71
72
1. HTML CSS
</pre>
</body>
</html>
.1.24 , , <PRE>.
. 1.24.
<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>
, ,
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 : ,
, -,
73
74
1. HTML CSS
.
HTML-: , , , ,
, . .
,
(.1.26). .
.
.
, .
, .
, .
. 1.26.
. . ,
.1.27, , .
,
. <table>
</table>:
. 1.27.
<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>
75
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>
. 1.29.
Internet Explorer
.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 -
Box Border
. 1.30.
77
78
1. HTML CSS
Hsides ;
Lhs ;
Rhs ;
Void ;
Vsides .
None ;
Rows .
</td></tr>
<tr><td>. </td><td>
</td></tr>
.1.31 ,
.
,
,
frame rules.
width
<table>. (width="250"), (width="80%"). ,
600, , .
, .
height.
. . 1.31. HTML-
.
-
.
,
.
.1.32 1.33 ,
.
80% , 50% .
100. ,
400.
79
80
1. HTML CSS
. 1.32. 80%
. 1.33. 300
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>
81
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>
<tr><td>
<Tbody>
, , , , ( ). ,
.
1. .
2. .
<table>,
<tr>, <th> <td> align valign.
align
:
<table align = left/right/center> -
/ ;
/ ;
/ (
);
/
( ).
, , ,
. char
.
valign
:
<table valign = bottom/middle/top> -
// ( );
//;
//;
83
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>
. 1.34.
. 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>
85
86
1. HTML CSS
HTML . bgcolor
, , , ,
, .
<td bgcolor="#000000">, <td></td>, , .1.36.
. 1.36. bgcolor
background
, :
<td background="img/fon.gif">
,
, .
,
(.1.37).
. 1.37. HTML-
colspan .
, ,
<table> ,
.
. .1.38 ,
www.ya.ru.
-.
.
, .
,
, .
HTML-
: , , .. ,
.
87
88
1. HTML CSS
. 1.38.
, HTML-
<IMG>. .
. : ,
. , .
HTML- <IMG>.
SRC, .
:
<IMG SRC="image.jpg">
, , (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>
<body>
. 1.39.
89
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 .
:
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.
.
91
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>
.1.41 1.48.
, .
. 1.41.
.
.
, HSPACE VSPACE
<IMG>.
.
. BORDER, .
1.49 (border) (vspace,
hspace) 10,
50.
1.49.
<html>
<head>
<title> </title>
93
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.
, , ,
,
. ,
. , , ?
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 , ,
.
95
96
1. HTML CSS
. 1.44.
,
.
, , . . , , .
: ,
, -, -
.
.
,
.
, .
, .
- (PHP, Perl),
. ,
HTML.
<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 ,
.
97
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,
.
,
. ,
. , .
<INPUT>
<INPUT> .
,
.
, , TYPE. .1.8 , .
1.8. TYPE
text
password
button
file
image
checkbox
99
100
1. HTML CSS
1.8 ()
radio
reset
submit
hidden
NAME,
.
.
, .
, ,
. DISABLED.
VALUE , . ,
, . . ,
, ,
. , , .
,
.
TYPE="text".
MAXLENGHT,
,
.
SIZE. ,
. , ,
. .
1.54 . , , .
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". , ,
101
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.
, ,
. ,
.
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>
103
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" />
. 1.48.
TYPE="file".
, ,
( ).
1.58 .
size 35.
1.58.
<html>
<head>
<title> </title>
</head>
<body>
105
106
1. HTML CSS
. 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">
.
.
.
<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>
107
108
1. HTML CSS
. 1.50.
CSS
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.
109
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
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 }
111
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
, .
CSS <P>, -
align, :
P[align] { color: blue;}
, CSS, SPAN,
class example:
SPAN[class=example] { color: blue; }
, <P> .
-
. TABLE, width 90%, height 50%:
~= =.
A[href="http://www.yoursite.com/"]
, lang
fr , :
*[LANG=fr] { display : none }
lang,
, HTML-, class (.) ~=. , DIV.value DIV[class~=value]
.
.
, class=test
:
113
114
1. HTML CSS
/* 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
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, .
115
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
-
. CSS :link :visited :
:link , ;
:visited , .
{ color: red }
, :
<A class="external" href="http://yoursite.com/"></A>
:
A.external:visited { color: blue }
HTML- ,
. CSS
:
:hover , (
, ), ;
:active , ,
, , , ;
:focus , ,
, :
A:link
{ color: red }
/* */
/* */
{ color: white }
/* */
117
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, texttransform, 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
1.65
.
1.65.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<TITLE> 7. </TITLE>
<STYLE type="text/css">
P
{ text-transform: uppercase }
</STYLE>
</HEAD>
<BODY>
<P><SPAN></SPAN>
" HTML CSS".</P>
</BODY>
</HTML>
1.65 ,
.1.52.
. 1.52.
, .
.
P ,
119
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
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;
}
, , ,
.
121
122
1. HTML CSS
, ,
.
.
font-family ,
. ,
.
, . ,
.
. ,
. CSS : serif, sans-serif, monospace, fantasy cursive.
, . , ,
.
, , .
.
, :
serif Times New Roman, Garamond, Georgia;
sans-serif Trebuchet, Arial, Verdana;
monospace Courier, Courier New, Andele Mono.
CSS
, , , .
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. .
123
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
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 .
125
126
1. HTML CSS
.
, .
, ,
.
none :
, .
.
underline,
. ,
( ), none.
, underline ,
:
A {
text-decoration: none;
}
A:hover {
text-decoration: underline;
}
letter-spacing. .
6:
H1 {
letter-spacing: 6px;
}
, wordspacing.
normal, .
H1 { word-spacing: 1em }
<H1>
1em.
CSS
text-transform . :
capitalize ;
uppercase ;
lowercase .
CSS .
white-space. , , .
normal. -
pre. -
. , .
nowrap. ,
normal. , , <BR>.
:
BODY { white-space: pre }
HTML- , , .
CSS
CSS .
, .
, ( backgroundcolor). , ..
127
128
1. HTML CSS
CSS .
: background-color, backgroundimage, background-repeat, background-attachment, backgroundposition 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
, backgroundattachment, , ( 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 }
.
- .
, , ,
. ,
129
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, paddingbottom padding-left, , , , ,
. padding
. .
, , , . , -
CSS
,
, 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
131
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
border-style .
, , border-width.
:
#xyz { border-style: solid dotted }
solid, dotted.
none,
, .
, ( <DIV>).
,
.
. HTML-.
,
.
. .
position float , .
.
static. ,
. left top .
relative.
( ).
. , , .
absolute. ( )
133
134
1. HTML CSS
. . ,
. ,
.
fixed. -
, .
( ). , , (,
). , fixed -.
, , position , static. ,
:
top -
right
bottom
left -
.
-
, auto.
CSS
,
. , , , .
, . 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>
135
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
. 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;
137
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>
</DIV>
CSS
</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>
139
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>
.
.
, , .
.
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 ,
-. -
JavaScript-
HTML-.
,
htm html. , Windows
WordPad.
, -,
Microsoft FrontPage Adobe Dreamweaver ( Macromedia
Dreamweaver). -
, , . ,
HTML JavaScript, .
,
, -
HTML JavaScript.
, -
.
, , , - .
, -, - -. , , -, . ,
- -,
, .
143
144
2. JavaScript
-.
HTML- :
;
;
<script>.
, - <a>, href , . JavaScript-, javascript:
( ). :
<a href="javascript:alert(', !');"> </a>
, JavaScript
alert(', !');
, (.2.1).
. 2.1.
alert(),
, .
.
,
-. , :
, HTML-.
- , ,
. HTML
, . JavaScript, , :
<p onclick="alert(' !');"> </p>
145
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>
//
// ,
<!--
//
</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>
147
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 .
, ,
. , , if If JavaScript
. , .
1. , .
2. .
3. 2.2.
2.2.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows1251">
<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).
,
-, -, -.
- .
149
150
2. JavaScript
. 2.3. -
JavaScript
JavaScript: , ,
, , .. ,
.
,
, , , ,
, , ,
..
, .
:
, ( );
, ;
, URL;
, ,
, ;
, .
JavaScript
/ 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.
prompt()
. 2.4.
prompt() (2.4).
2.4.
<html>
<head>
<title> </title>
</head>
151
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
<title> </title>
</head>
<script>
confirm(" ");
</script>
<body>
</body>
</html>
(.2.6).
-
OK
Cancel.
. 2.6.
,
, . . JavaScript : ,
, .
, , . ,
. :
;
;
:
A Z a z;
(_)
, ;
($)
153
154
2. JavaScript
, , flagId FlagID. , .
.2.1 .
2.1. JavaScript
count
2my
new
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
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
155
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
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(),
. , (
157
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
//
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.
159
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
<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).
161
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
(.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
163
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
,
.
. 2.11.
. , ,
. .2.7 .
2.7.
==
!=
>
true,
true,
true,
>=
true,
<
true,
<=
true,
===
true,
!==
true,
165
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
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"
167
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
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;
169
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
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:
171
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
</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++)
{
173
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
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);
175
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
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;
}
177
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
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);
}
179
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
</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) //
181
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
, , ..
,
.
, 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).
183
184
2. JavaScript
. 2.16.
JavaScript
JavaScript () , (). , . , JavaScript
:
Global , -
String ;
Number ;
Boolean ;
Array ;
Function ;
Date ;
Math ;
JavaScript
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).
185
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
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()
187
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
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).
189
190
2. JavaScript
2.15. Math
( e)
LN10
LN2
LOG10E
e
10
LOG2E
e 2
PI
SQRT1_2
1/2
SQRT2
abs()
acos()
( )
asin()
( )
atan()
( )
atan2()
( )
ceil()
cos()
exp()
floor()
log()
max()
min()
pow()
,
, ,
random()
,
0 1
round()
sin()
tan()
sqrt()
toSourse()
toString()
Object
JavaScript, , ,
Object, ,
(.2.16).
2.16. Object
constructor
prototype
toLocaleString()
toSource()
toString()
valueOf()
JavaScript - ,
-
.
,
.
-.
JavaScript, String, Math .
,
.
- HTML-
HTML-.
, -, , , ,
, . JavaScript
HTML-. .
191
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 -
.
.
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), .
193
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.
Window ,
, ,
:
defaultStatus , -
status , ;
frames ;
length ;
name , open, -
parent , , ;
self window , ;
top , .
195
196
2. JavaScript
(.2.18).
. 2.18.
, Window, ,
, , :
alert Alert ()
OK;
open ;
close ;
confirm Confirm ()
OK ;
prompt Prompt () ;
setTimeout ;
clearTimeout .
<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>.
197
198
2. JavaScript
; 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>
. , , .
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>
199
200
2. JavaScript
2.29
Timer, Alert
3 (.2.19).
setTimeout() Window.
3000 (3) ,
.
alert: "alert(' !')".
. 2.19. 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>
</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
appVersion , , -
userAgent , ,
, . appCodeName appVersion.
201
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>
. 2.20.
Screen
Screen
: , , .. -
, .
Screen :
width ( );
height ( );
203
204
2. JavaScript
availHeight
availWidth
colorDepth ; 16 2,
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
- .
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 . -
.
205
206
2. JavaScript
, , (.2.22).
-
History:
go - -
. 2.22.
-
,
( 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(), .
History,
. ,
. - ,
.
Location
. 2.23.
URL- .
Location JavaScript
URL, -.
Location
HTTP-:
href URL- -;
hash URL- -,
name ( );
host URL- ,
hostname , --
pathname - ;
port HTTP-, -
- ( , 80
, HTTP);
, http:);
search (
"?").
href Location
2.35.
207
208
2. JavaScript
. 2.24.
Location :
assign , URL- -
, ;
reload - ( ,
, );
replace - , URL-
;
HTML .
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
209
210
2. JavaScript
, ,
.
-, , . HTML-
-, , ,
, , ..
- HTML-, HTML. HTML-
Document,
JavaScript.
Document DOM.
.
,
, , ( ).
, Document.
Document :
anchors (), HTML-
links HTML-,
images -;
forms HTML.
JavaScript ,
, HTML-
.
, Document,
2.37.
2.37. anchors
<HTML>
<HEAD>
<TITLE>Anchors</TITLE>
</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.
211
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.
<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>.
213
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
, Document.
.
. 2.27.
lastModified
getElementsByName({_}) ,
getElementById({ID}) ,
. ID. .
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-
, input: (.2.29).
. 2.28.
215
216
2. JavaScript
. 2.29. input
Document
, -.
JavaScript -,
.
-.
HTML- JavaScript .
.
, -
img1, img2 img3. ,
.
- Document. images.
images[0], images[1], images[2] ..
, , .
,
document.images[0].
.
- ,
.
, , , 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- :
;
.
.
,
217
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>
</center>
</BODY>
</HTML>
HTML-
(.2.30). onClick
doit(),
,
.
.
. 2.30.
. 2.31.
,
JavaScript.
219
220
2. JavaScript
-,
JavaScript.
,
- , . . JavaScript
-
( 3).
. , ,
.
JavaScript :
. , .
, JavaScript . .
Form . <form>
.
HTML Form :
<form
[name=""]
[accept=""]
[accept-charset=""]
[action="URL"]
[enctype=""]
[metod=get|post]
[target=""]
[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]).
221
222
2. JavaScript
. 2.32.
,
.
, , , , ..
. , ,
. elements . 2.42 ,
.
2.42.
<html>
<head>
<title> </title>
<script>
//
function validateForm(){
var validateFlag=true;
//
// 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>
<!-- -->
223
224
2. JavaScript
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>
<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() .
225
226
2. JavaScript
. 2.33.
,
, (.2.17).
2.17. ,
action
reset()
onReset
enctype
submit()
onSubmit
elements[]
length
method
name
target
action
action URL- ,
:
<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
227
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 .
.
. 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=' ';">
229
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>
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 .
231
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;
}
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);
233
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>
. 2.35.
, , .
, ,
.
. 2.44 ,
.
2.44.
<html>
<head>
<title></title>
235
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
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 ,
237
238
2. JavaScript
, . , .
, ,
.
, . HTML -
, ,
. , , , , .. -
. ,
. , .
(DOM). , .
JavaScript
: , , ,
, , , .
DOM- .
, , .. Node,
DOM. Node ,
(.2.18).
2.18. Node
nodeName
nodeValue
nodeType
,
Node
parentNode
Node
childNodes
,
, NodeList
HTML
firstChild
Node
lastChild
Node
previousSibling
Node
nextSibling
Node
attributes
,
, NamedNodeMap
ownerDocument
Document,
namespaceURI
URI
prefix
localName
baseURI
URI ,
textContent
#text
insertBefore(newChild,
refChild)
newChild
refChild
replaceChild(newChild,
oldChild)
oldChild newChild
removeChild(oldChild)
oldChild
appendChild(newChild)
newChild
hasChildNodes()
true,
, false
cloneNode(deep)
. deep true, ,
normalize()
Text
isSupported(feature, version)
hasAttributes()
true,
, false
Node, .
239
240
2. JavaScript
, DOM-
JavaScript. :
getElementsByTagName(),
getElementById(), id -
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
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>
241
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.
2 getElementById() h2Tag2 . ,
(.2.37).
3 View3(),
DOM- .
. documentElement Element, .
, <body> BodyNode,
<h2>. View3()
, Opera Mozilla Firefox
, . ,
, ,
. , .
HTML
. 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");
243
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
, . 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).
245
246
2. JavaScript
. 2.39.
-
- ,
, . ,
, .
.
(rollover) :
onMouseDown ,
onMouseUp ,
onMouseOver ,
onMouseOut ,
2.48.
HTML
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, -
247
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
<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).
249
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
<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).
251
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
//
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).
253
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
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.
255
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
<p> .<p>
<p id="par" onMouseOver="Change1()" onMouseOut="Change2()">
, .
</p>
</body>
</html>
par :
.
,
(.2.45).
. 2.45.
, .
. ,
(2.54).
2.54.
<html>
<head>
<title></title>
<script>
257
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
}
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;
259
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().
. 2.46.
, . ,
, , ..
JavaScript.
,
- .
.
HTML . -
.
HTML JavaScript, -.
261
Apache
- Apache MySQL
-, Perl. ,
.
Apache
- Apache. , -, , -, . ,
Apache , ,
.
Apache
, , ..
, , Perl.
Apache
Apache -.
, HTML- .
- , http://www.
google.ru, -, ,
, HTML-.
, Apache ( -).
.
http, https .
. - , -
.
( ) .
, - ,
html-, - . PHP, Perl, MySQL.
263
264
, , .
. -
,
.
.
- 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
Win32 Binary including OpenSSL 0.9.8h (MSI Installer);
.
Windows ( ).
, , ,
Apache .
, .
1. (Setup Wizard) apache_2.2.9-win32x86-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 ( ).
265
266
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
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.
267
268
. 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
: 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
.
269
270
, , 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
, ActivePerl (.3.6).
. 3.6.
.
,
(. 3.7).
. 3.7.
271
272
: 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
. 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 :
- .
273
274
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
. , 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";
275
276
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
, ,
HTML-. Perl : .
,
.
, Perl.
. , HTML
.
, . Perl
,
, , , . ,
.
. Perl
, ( , ..).
,
, , ,
. , , , . .
.
"</BODY></HTML>";
277
278
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
- , ,
;
( !
-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&
.
279
280
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
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);
281
282
$input, . , .
Perl . ,
Java, PHP. Perl .
(.regular expressions)
,
. . ,
, , .
. .
, . , -
.
, . ,
, HTML- .
, . -
, HTML- .
, . ,
.
, . ,
Perl .
. . , //
, , .
, , Perl .
.
^ .
$ .
Perl
. , .
* .
+ .
? .
x|y x y.
{n}, n . n -
{n,}, n . n
{n,m}, n m . n
m . , /x{0,1}/ /x?/.
[xyz] .
[^xyz] ,
[a-z] .
[^a-z] , -
\w , .
. , ^$
, ,
.
S , -
. , . ,
.
283
284
\ , . # , .
:
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
Cookies =, ,
, , .
, , , .
: HTTP-
cookie Set-cookie.
cookies, Setcookie 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: cookiename=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 .
285
286
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
. A
B, B
A. , A , B . ,
.
287
288
(foreign key) ,
( ,
).
.
,
, . , ,
:
(, ),
( ).
, ,
.
, ( ) ( ,
). , .
,
,
.
, .
.
, , , -.
, .
, .
, , .
,
, .
. ,
, ,
. .
MySQL
, , ; , , .
,
.
, ,
( ).
, , .
,
. ,
,
. .
, . .
, MySQL
.
, ,
, .
:
, . MySQL
. .
(RESTRICT):
, . ,
, .
/ (CASCADE): -
289
290
.
.
(SET NULL): -
,
, (NULL).
.
, , ,
, .
MySQL . ,
, .
.
, ,
.
-
.
. -
, (, phpMyAdmin,
-).
.
, , ,
.
. SQL-
.
.
MySQL -. Windows- MySQL - http://dev.mysql.com/
MySQL
.;
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
291
292
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
. 3.13.
6. ,
Configure the MySQL Server now ( MySQL ).
Finish ().
MySQL (.3.14). Standard Confi
guration.
. 3.14.
, MySQL ,
(.3.15).
293
294
. 3.15.
, , MySQL, . MySQL ,
. -,
, .
, , (.3.16).
. 3.16.
MySQL
GUITools
Complete (.3.17).
. MySQL Administrator,
Server Host localhost ( IP- ), root ,
MySQL (.3.18).
,
(.3.19).
MySQL, ,
.
. 3.18.
root
, .
( ,
, cmd
OK),
295
296
. 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
MySQL, , (localhost) , :
mysql u root p
mysql>
(.3.20).
. 3.20. MySQL
: ,
, .
, exit
Enter.
MySQL
MySQL Query Browser, .
,
(.3.21).
MySQL , , . , , ( ,
..).
297
298
, , . ,
:
. ,
.
.
SQL-: ,
,
SQL-,
MySQL ( , ).
, SQL-
.
Enter. ,
SET NAMES cp866;
.3.22 .
MySQL
. 3.22.
. , CP-866
( Windows).
,
. ,
.
SHOW DATABASES , MySQL. (.3.23).
. 3.23.
299
300
,
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
[< >])
[< >];
.
( 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). , .
VARCHAR, .
.
301
302
-, , id ,
PRIMARY KEY (id).
, . , .
ALTER TABLE ,
.
: ,
, :
, .
.
INSERT [INTO] < >
[(< >)]
VALUES
(< 1>),
(< 2>),
...
(< N>);
INSERT :
, ;
, ( -
, ).
, . ,
, MySQL
.
.
,
, . .
MySQL
,
. .
.
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 ( ,
).
303
304
UPDATE.
.
SET
, .
,
.
.
. .
. , (. ), , , ,
.
, UPDATE. . ,
, ,
.
.
SQL- SELECT:
SELECT * FROM < >;
,
SELECT * FROM Customers;
.
,
. , ,
,
SELECT name, phone, rating FROM Customers;
MySQL
, , . ,
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
,
- (, , .).
305
306
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
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.
307
308
. 3.25.
. 3.26.
4. :
(.3.27) (.3.28).
MySQL
. 3.27.
. 3.28.
, .
5. ,
:
(.3.29).
309
310
. 3.29.
6. (.3.30).
. 3.30.
7. , , http://localhost/
(.3.31).
MySQL
. 3.31.
SQL Perl
, Perl MySQL,
:
my $dsn = "DBI:MYSQL:test:localhost";
my $dbh = DBI->connect($dsn, "username", "password") ||
die "[err]: MySQL: $!";
: -,
. -, MySQL
311
312
. 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 .
.
, :
$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.
313
314
, ,
. , ,
.
, Perl MySQL
. , , , . ,
, , Perl
MySQL.
(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!
,
. , , ,
.
Joomla!.
-,
MySQL.
. , .
-
, , .
, -
, , .
-
.
,
.
,
.
Joomla!.
Joomla! .
, .
, , , -
, .
317
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!
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! .
319
320
4. (CMS)
5. ,
Joomla!.
Joomla! (.4.2).
. 4.2.
.
zlib , , -
, ()
gzip.
XML
AJAX, .
MySQL MySQL ,
Joomla! ; , .
configuration.php
Joomla! .
.
CMS Joomla!
-
. .
Joomla! ,
, .
- , ,
.
6. (.4.3) ,
GNU/GPL. -
, . .
. 4.3. GNU/GPL
7. , Joomla!
(.4.4).
, Joomla! . MySQL.
MySQL .
MySQL. MySQL
321
322
4. (CMS)
. 4.4. MySQL
IP- , -
MySQL (, ).
,
,
.
,
MySQL , .
:
, ;
-
, ,
old_;
, ;
Joomla!.
CMS Joomla!
Joomla! . ,
. jos_.
MySQL .
8. FTP (.4.5).
. 4.5. FTP
323
324
4. (CMS)
Joomla!
. , .
. 4.6.
-/ . , . ,
-. , - (.4.7).
.
,
.
10. , ( ),
( ) (.4.8).
Joomla!, installation
, . , installation ,
.
.
CMS Joomla!
. 4.7. -
. 4.8.
325
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!
Login (.4.10).
. 4.10.
:
( ), ().
, Site4Control Panel (4 ).
, , .
1.5.5, 1.5.4.
.
.,
.
327
328
4. (CMS)
.
1. ru-RU_Joomla_1.5.4_site.zip.
2. ru-RU.
ru-RU,
, .
CMS Joomla!
, .
, , ,
-, .
,
. , , ,
.
.
, .
, Joomla!.
, , Joomla! .
.
1.
, .
2. 4 (.4.11).
. 4.11.
329
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!
Editor , ,
( ).
Publisher , , -
Editor, .
.
Registered.
, .
1.
Super Administrator.
2. 4 , .
3. (.4.12).
. 4.12.
4.
.
331
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!
. 4.13.
2. zip-, , .
3. &
, .
4. , ,
( ) .
5. ,
URL. URL ,
, .
, .
4 . ,
.
, , (,
).
333
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!
. .
1. , .
2. ,
(..4.14).
, Joomla!.
. ,
.
. ,
. , , .
, PHP JavaScript.
, , . , ,
, .
: , .
:
. ,
.
.
, .
. , , xml-, . .
Joomla!
, , . , .
,
.
335
336
4. (CMS)
, .
4
(.4.15).
. 4.15.
, .
(..4.15).
(.4.16).
. 4.16.
( , -
, ).
.
CMS Joomla!
; -
Copy of, .
.
. -
,
.
.
.
.
.
, .
, .
.
, .
.
. -
:
(Public) ;
Registered () -
;
Special ()
Author () .
. -
, ( ).
, .
, . , -
,
.
ID ,
. Joomla!, , . .
337
338
4. (CMS)
(.4.17).
. 4.17.
.
.
, .
, .
, .
.
.
. {loadposition xxx}, xxx
, .
, {loadposition xxx},
.
CMS Joomla!
, , tp=1 . , http://
localhost/joomla ,
. : http://localhost/
joomla?tp=1. , , .
, ( ) . ,
,
.
ID .
. .
, .
, . .
, -
. .
.
mod_mainmenu,
. ,
.
.
,
.
-
. .
, .
, -
. ,
. , , Ctrl
.
.
.
339
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!
. 4.18. rhuk_milkyway
. 4.19.
341
342
4. (CMS)
7. . , ,
(.4.20) (..4.18),
(, .) .
. 4.20. beez
, ,
.
(, ) ,
, .
,
. ,
, ( , ). HTML. Joomla! 1.5
.
. ,
.
CMS Joomla!
1. .
2. 4 .
3. , .
4. .
. ,
.4.21.
. 4.21.
.
, .
, .
. -
.
.
. :
343
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
.
1. drupal-6.3.tar.gz Drupal.ru.
2. ( , drupal)
.
3. http://localhost/drupal, (.4.22).
. 4.22. 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. , .
345
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
. 4.24.
Administrator account :
Username, Password Confirm password ,
;
E-mail address ,
,
.
Server settings , .
Default time zone ,
.
, .
Clean URLs , .
, :
GET ( ) POST.
347
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
,
. , Joomla! ,
Drupal ,
(
).
. 4.26.
, CMS
Drupal.
Drupal already installed (Drupal
), , , .htaccess, ,
ExpiresActive Off.
, , , ,
Drupal. .htaccess php
value memory limit 32M. 32M
349
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
. 4.27.
(..4.27) . :
Username (/ ) ;
Status () ( );
Roles (/) , ;
Member for ( ) ,
;
Last access ( ) , -
;
Operations () ,
.
- ,
. .
1. - Show
only users where.
351
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 (44) . Drupal
:
anonymous user ( ) -
;
authenticated user ( )
.
3. edit permissions ( )
, . (.4.28).
CMS Drupal
. 4.28.
.
1. .
2. (..4.28),
, . , ,
.
3. Save permissions ( )
.
CMS Drupal .
, Joomla!.
,
. modules Drupal.
353
354
4. (CMS)
Drupal , .
1. http://localhost/
drupal .
2. .
, ,
, . .
(.4.29) By task ( ),
By modules ( ). .
. 4.29.
Drupal , Joomla!,
.
, ,
CMS Drupal
.
.
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!. ,
, .
355
356
4. (CMS)
. 4.30.
. ,
. Drupal :
.
: , .
, .
, , , ,
.
, .
.
1. Drupal.
2. .
3. Create content ( )
, (.4.31).
CMS Drupal
. 4.31.
4. , Page ( ) Story ( ) ,
. ,
(.4.32).
, .
Title () ,
.
Body () .
. (.4.33).
357
358
4. (CMS)
. 4.32.
. 4.33.
.
Menu link title ( ) ,
.
Parent item ( )
, . .
Weight () . ,
. ,
.
CMS Drupal
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 () .
359
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
. 4.36.
3. ,
Edit () ,
Add Item ( )
.
,
(.4.37).
Menu settings .
Path () , .
:
Drupal, node/add;
URL;
<front> .
,
. , , ,
, <front>.
Menu link title ( ) .
Description () .
361
362
4. (CMS)
. 4.37.
Enabled () ,
.
Expanded () ,
.
Parent item ( ) ,
.
Weight () . ,
( ).
Joomla! Drupal. , , .
, . -
,
Joomla! .
. Drupal ,
PHP, JavaScript , . CMS
, , , -.
363
PHP
6
PHP
PHP
PHP
PHP
PHP
PHP
PHP
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
-.
365
366
5. PHP6
- ,
Windows
,
PHP
:
<?php
phpinfo
();
?>
htdocs
Apache
, , examples,
PHP
-. start.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
<
h
1>
PHP
HTML
</
h
1>
<?
php
echo
" !
PHP
-
Web
!";
?>
</
body>
</
html>
hello.php examples.
http
://
localhost
/
examples
/
hello
.
php, (.5.1).
5.1. ,
HTML
<h1> , <?php ?> echo . echo
PHP
,
-. 5.1 :
echo " ";
() . . , :
367
368
5. PHP6
echo "872976";
HTML
, HTML
-. ,
e
cho "<b> </b> ";
.
echo . ,
", "
", "
PHP
";
, :
echo " : \" ";
, .
PHP
, .
, ,
, (
). ,
, .
PHP
, . -, /* */, :
<?php
/*
PHP
*/
phpinfo
();
?>
,
, .
:
<?php
/*
/*
PHP
*/
*/
phpinfo
();
?>
*/
,
/* */.
,
. // #, :
<?php
//
//
PHP
//
phpinfo
(); #
PHP
PHP
?>
- , .
: .
, , . , .
PHP
($).
, - :
369
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
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
371
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
, , , :
<?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", ""=>"", ""=>
"");
?>
373
374
5. PHP6
: ,
. =>
.
Resource
resource ,
. ,
. , .
NULL
. ,
. NULL
:
NULL;
- ;
unset().
PHP
- ,
- .. ,
. , , , ,
: 3.1415926535. pi
define ("pi", 3.1415926535);
pi,
.
, , .
define() :
define (_, , $case_sen);
PHP
$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 ,
.
375
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
+ ;
- ;
* ;
/ ;
% .
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
.
, . ,
377
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
$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--
.5.4.
379
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
, ;
$var2 ;
$var2 .
,
.
if, . :
if
(_)
PHP
:
== () $x==$y , $x $y;
=== () $x===$y , $x
$y ;
!= () $x!=$y , $x $y;
<> () $x<>$y , $x $y;
!== ( ) $x!==$y , $x
$y ;
$y;
>= ( ) $x>=$y , $x
$y.
:
<?php
$temperature=26;
if($temperature>=24)
echo "
"
?>
,
.
, , . , :
381
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.
||
&&
PHP
&
!=
<<= >>=
<< >>
10
+-
11
*/%
12
++ --
PHP
,
.
PHP
.
if, PHP
.
if
if :
if (_)
{
1;
2;
}
if , ,
if. ,
. :
<?
php
if
($
x
< $
y
) {
383
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
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;]
385
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
, 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>
}
?>
x = ", $x;
387
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
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
";
389
390
5. PHP6
$
fruits
[""] = "2
USD
";
$
fruits
[""] = "3
USD
";
foreach ($fruits as $key => $value) {
echo "<b>
:
", $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
- , :
break(_);
1,
, .
continue
continue
. continue
,
.
continue
. -,
- ,
.
continue:
<?php
$
i
=0;
while
($
i
++<15) {
if
($
i
==6)
continue;
echo "<b>
$
i
";
}
?>
.
PHP
PHP
, , ,
, ,
. , ,
, .
PHP
. , .
391
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
$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;
?>
, .
, .
. :
393
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
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()
395
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
-,
, -.
-
PHP
MySQL
cookie
398
6. - PHP
PHP
,
. , ,
-.
PHP
, -, ,
. , - , -,
-.
, ,
, , , .. ,
MySQL
( ),
MySQL
, , , -
.
MySQL
PHP
,
, ,
, , .
, . MySQL
, -
. , http
://
php
.
su
PHP
,
.
,
cookie
-
-.
, .
, -. , -,
PHP
.
-.
-, :
(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).
399
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.
,
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
401
402
6. - PHP
// 6.2
echo
$_
POST
["
name
"];
}
else
{
?>
// 6.1
<h1>
</h1>
<form method="post"
action="simple_form_script.php">
, . ,
, ,
if(isset($_REQUEST["name"]))
isset() if
- : , false, true.
-,
PO
ST["name"]
, $_
false. else, . ,
-, $_
PO
ST["name"]
, , if, .
, ,
HTML
HTML
PHP
.
simple_form_script.php examples,
://
localhost
/
examplex
/
simple
_
form
_
script
.
php , http
.
.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
403
404
6. - PHP
{
?>
<! !>
<h1>
</h1>
<form method="post"
action="complex_form.php">
1.
2.
3.
</textarea>
<br><br>
<Select name="sport">
<option>
</option>
<option>
</option>
<option>
</option>
</select>
<br><br><br><br> c ?
">
">
<br>
">
<br><br>
<input type=submit value="OK">
</form>
<?php
}
?>
</center>
</body>
</html>
, complex_form.php examples
://
localhost
/
examples
/
complex
_
script
.
, http
php . .6.3.
.6.3. -
, -.
, (.6.4).
. ,
, : $_POST
echo
6.2.
- .
.
405
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>
<form
enctype="multipart/form-data"
method="post"
action="form_file.php">
">
</form>
</center>
</body>
</html>
form_file.html
examples
.6.5).
.6.5.
,
form_file.php (6.6).
6.6.
<html>
<head>
407
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 .
"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
,
. , , . ,
.
409
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
, 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("
_
close
($
connection
);
?>
411
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
PHP
. mysql_query(),
MySQL
:
resource mysql_query ( string mysql_query [, resource mysql_connection])
false, ,
, true ( ).
mysql_query , mysql_
connection MySQL
MySQL
, 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
MySQL
my_d
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).
413
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(" ");
//
MySQL
die(" ");
//
$login=$_POST["login"];
$password=$_POST["password"];
$preferences=$_POST["preferences"];
$sport=$_POST["sport"];
$sportsmen=$_POST["sportsmen"];
$message=$_POST["message"];
//
//
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
415
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
(" ");
//
" ";
$account=mysql_fetch_array($result);
MySQL
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.
417
418
6. - PHP
, MySQL
PHP
,
, , .
. PHP
, ,
-.
-, , ,
. , , ,
cookie
-. .
, , . , - ,
..
$_SESSION. , :
$_
SESSION
[
background
]="";
.
, . , ,
cookie
-,
.
session_start(),
. $_SESSION,
, - . 6.9
.
,
, $_SESSION.
6.9.
<?php
session_start();
?>
<
html>
<
head>
<
title
> </
title>
</
head>
<
body>
<center>
<h1> </h1>
<?php
if(isset($_SESSION[counter])==false)
$_SESSION[counter]=0;
$_SESSION[counter]++;
echo "
";
?>
</center>
</body>
</html>
. (, F5)
session_start(0), ,
, . .6.8
.
.6.8.
419
420
6. - PHP
, :
,
$_SESSION. unset(). ,
:
session_start();
unset($_SESSION[counter];
, ,
, .
, session_id(),
:
string session_id ([string id])
,
id, .
session_id() ,
session_start().
az
,A
Z
09.
cookie
-. PHP
, PHPSESSID.
,
cookie
,
PHP
.
,
cookie
- .
cookie
cookie
,
.
,
- ,
.
, cookie
HTTP
-, ,
HTML
, HTTP
HTML
- .
cookie
cookie
- setcookie(),
:
int setcookie (string name [, string value [, int expire [, string path [,
string domain [, int secure]]]]])
name
cookie
, value . "".
:
expire cookie
;
;
path , cookie
;
domain , cookie
cookie
secure
.
, 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>
cookie
"color" "green",
read_cookie.php, . cookie.
php examples. cookie
(6.11).
421
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
6.11,
cookie
$_COOKIE. cookie.php? ,
-, .
cookie
, setcookie()
, , "" 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
423
424
6. - PHP
smtp
SMTP
, sendmail_from
.
, -.
,
SMTP
POP
3.
XAMPP
,
Mercury
XAMPP
.
,
, postmaster@localhost.
PHP
mail(),
:
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"]))
?>
<h1>
</h1>
<?php
if(!mail($_POST["to"], $_POST["subject"], $_POST["message"]))
echo " ";
else
echo " ";
}
else
{
?>
<h1> </h1>
<form method="post" action="mail.php">
<br>
">
</form>
<?php
}
?>
</
center>
</
body>
</
html>
, .
:
<input name="lb" type="hidden" value="Yes">
lb
:
if(isset($_POST["lb"]))
425
426
6. - PHP
,
PHP
,
.5. -, ,
MySQL
PHP
,
cookie
-. ,
, -.
PHP
. (
Ajax
),
, , .
,
-, .
Ajax
, - , ,
.
AJAX
AJAX
XML
MySQL
428
7. AJAX
-, PHP
. , ,
, PHP
.
, -, ,
, : ( , . usability , ,
), , .
- , - (, Apache
), , . , .
, , . , ,
, . .
,
? ,
,
, - , ,
, , .
,
,
.
,
(
-,
, , ).
- , , , .
-,
, AJAX
,
Asynchronous
JavaScript
and
XML
( JavaScript
XML
). .
AJAX
AJAX
AJAX
, ,
, . ,
-, AJAX
,
. , , , . , ,
( ), , , ,
.
?
,
AJAX
. , , ,
, ,
.
. , -
AJAX
,
. -:
- , ,
, , - ,
, , .. ,
AJAX
. ,
, ( ) .
AJAX
? !
, ,
,
AJAX
.
, .
. ,
AJAX
(
Yahoo
,
Google
), -
.
AJAX
? -, ,
JavaScript
XML
. JavaScript
.3 ,
XML
.
429
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
,
. (?) , <? ?>.
,
HTML.
, .
DDT
,
XML
.
DTD
XML
:
<!ELEMENT HELLO (TITLE, BODY)>
<!ELEMENT TITLE (#PCDATA)>
<!
ELEMENT
BODY
(#
PCDATA
)>
, XML
DOCTYPE. , , ,
DTD.
DTD
hello.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)>
431
432
7. AJAX
XML</title>
<body>
XML-
</body>
</hello>
, XML
. , , (
HELLO) .
TITLE BODY, DTD
. , , .
XML
,
AJAX
.
-
AJAX
.
- AJAX
examples ajax.html
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
, 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(" ");
} } }
433
434
7. AJAX
examples ajax.js.
PHP
examples ajax.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
.7.1.
AJAX
AJAX
, -.
HTML
7.1
Java
Script
, 7.2.
HTML
- Java
Script
, 7.2:
if(window.ActiveXObject)
var xmlHttp = new ActiveXObject("Microsoft.
XMLHTTP");
else
.7.2.
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);
}
435
436
7. AJAX
:
AJAX
.
XMLHttpRequest. readyState, :
0 ;
1 ;
2 ;
3 ;
4 .
, , ,
. setTimeout()
request():
setTimeout
(
request
(), 1000);
AJAX
, , :
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
o n r e a d y s t a t e c h a n g e
XMLHttpRequest ResponseHandler().
AJAX
. s e n d ( )
XMLHttpRequest:
xmlHttp
.
send
(
null
);
.
PHP
(. 7.3).
XML
-:
header(Content-Type: text/xml);
echo <?xml version="1.0" ?>;
, , xml. ,
XML
,
:
echo
<
response
>;
xml. , ,
PHP
http://localhost/ajax.
php?login=
XML
.7.3.
.7.3.
XML
$
login
= $_
GET
[
login
];
437
438
7. AJAX
$userNames,
PHP
in_array(), , ,
echo
Hello
,
user
. $
login
. !;
, .
, , .
, trim()
trim($login) ,
. ,
(.7.4).
.7.4.
, , (.7.5).
.7.5.
xml,
?
:
AJAX
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>
439
440
7. AJAX
,
<div id="Message" />.
, -,
AJAX
.
1.
ajax.html
c
AJAX
.
2.
request() AJAX
.
3.
request() XMLHttpRequest .
4.
XMLHttpRequest , 1
c
request().
5.
AJAX
, request() AJAX
:
ResponseHandler() AJAX
.
6.
request() .
7.
PHP
XML
.
8.
ResponseHandler().
, ResponseHandler() XML
,
(..7.4).
, (..7.3).
,
(..7.5).
9.
request() 1 . .
, XMLHttpRequest
, . - , -
XML
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>
441
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/>
else
var xmlHttp = new XMLHttpRequest();
function request() {
if (xmlHttp)
{
//
try
XML
{
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 +
",
443
444
7. AJAX
HTML
, localhost/examples/
users.html . , .7.6.
.7.6.
, users.js.
XMLHttpRequest , .
,
request(), .
XMLHttpRequest,
try/catch,
JavaScript
.
( ) . try/catch :
try
{
,
}
catch
{
,
}
.
, ,
.
MySQL
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
,
445
446
7. AJAX
MySQL
XML
. -
AJAX
, . -
AJAX
. 7.1 7.2,
,
PHP
,
MySQL
.
MySQL
, , 7.3 $UserNames:
PETYA, SERGEY, IVAN, MASHA, LENA.
MySQL
MySQL
<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
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("
");
}
}
}
447
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
{
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.
449
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
.
452
8.
, ,
, . , , ,
. , ,
, , . :
.
, ,
, , , . , ,
HTML- HTML-,
.
Microsoft Word, , , HTML-.
HTML-
4 (Tools4Spelling) F7.
,
.
, - - -. ,
, Internet Explorer, Mozilla Firefox
Opera. - : 800600, 1024768 12801024,
.
, ,
.
-.
, , ,
. ,
, .
, .
, -, , .
? !
, , Web Link Validator.
Web Link Validator ,
. - , , .
,
100000.
.
URL,
URL- , . , , , .
453
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 -,
.
- /.
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 ( ). .
455
456
8.
, , , Ctrl. , Delete ()
Toolbar ( ).
7. Verify () Toolbar ( ).
, .
, Stop ()
Toolbar ( ).
, /. ,
, , , .
.
, ,
(.8.3).
. 8.3.
, ,
. :
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, .
457
458
8.
2. New () Toolbar ( )
Qiuck Start ( ).
Qiuck Start ( ), URL (.8.5).
5. Start (), .
, Web Site Verification Process (
-) (.8.6).
Verification
progress ( ).
,
:
(Verified);
(Ignored);
459
460
8.
(Added). ,
.
URL- .
, Stop ().
6. , Web Site Verification
Process ( -), Close ().
(.8.7).
. 8.7.
, ,
, .
, :
All links ( );
Good links ( );
Broken links ( );
Non verified links ( );
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 ( );
461
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-, , , , ,
. , ,
. ,
? -. .
-
,
-, . 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 (() )
.
-,
. .
463
464
8.
2. HTML-, ,
(Open), Add File(s) ( ()).
File(s) to compress (() )
(.8.10).
. 8.10.
:
Name () ;
Type () ;
Path () ;
Date () ;
Size () ;
Packed () ;
Saved () -
;
Ratio () -
.
.
, HTML-. Add Folder ( ) Toolbar ( ).
, . .
1. Optimize () Toolbar ( ). Compress () (.8.11).
465
466
8.
. 8.11. Compress ()
,
.
Backup,
, .
C:\Program Files\Advanced HTML Optimizer\Backup.
2. Compress (), OK.
Overall
compressing performance ( ) (.8.12).
:
Optimized () ;
Elapsed time ( ) ;
Source size ( ) ;
-
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 () .
467
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.
, .
? ?
.
470
9.
. ,
, . !
- , -, .
:
,
.
HTTP HyperText Transfer Protocol ( ),
.
.
,
.
, . , .
,
. ,
.
, ,
. -
. .
,
.
,
,
.
, , , , ,
.
.
, .
, .
, , , , . 512
20 .
. , .
, .
- .
,
, , ,
.
. , ,
.
.
,
, .
.
- MHost.ru 5 15 .
: PHP-, , .
, , , . www.mchost.
ru. .9.1 MHost.ru.
471
472
9.
. 9.1. - MHost.ru
- , .
- www.hc.ru. .9.2
- .
- . ,
. , ,
. - ,
, ,
. .
. ,
.
Eomy.net ( www.eomy.net) . ,
. 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.
.
473
474
9.
,
. .
, . ,
-
.
:
;
;
;
;
10.
, . .
.
.
1. http://jino.ru/.
(.9.3).
2. , -.
(.9.4).
3. : , .
, , .
. 9.3.
4. , , : ,
.
5. ,
.
6.
.
7. . (.9.5).
, . , ,
.
, . .
475
476
9.
. 9.4.
. 9.5.
.
, (.9.6).
. 9.6.
:
, ,
;
, -
: ( ), FTP-, , MySQL,
;
,
;
,
477
478
9.
, , ,
;
.
, . , . .
1. .
.
2.
. (.9.7).
. 9.7.
3. / , ,
.
( ) ( ).
,
. ,
. ,
- , .
,
, . , .
, .
1.
. (.9.8).
. 9.8.
,
, , , , .
.
,
. domains. , .
479
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>
- . ,
,
. , .
, , , .
HTML-, ,
, -
. - .
, , , . , , -
, ,
. , , , . , .
, , , .
, , -, ,
.
, .
,
: , ,
. ,
. -
, .
content - 1024, . ,
. , -
, , . . , - .
-.
,
.
.
.
485
486
10.
<title> </title> 256. , .
256,
6080 , .
.
,
, , . ,
. ,
. , , , ,
, .
-
, .
- .
.
, ,
. ,
. , . , ,
.
? ,
.
, 98%
. , , , ( ).
,
- .
Rambler, ndex . , . ,
.
Rambler (http://www.rambler.ru/) , , ,
.
, .
, Rambler -,
. , ,
.., .
,
.
-
,
. , .
http://www.rambler.ru/doc/add_site_form.shtml.
.10.1.
. 10.1. Rambler
487
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), ,
,
.
. - .
. 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/).
, .
, , .
489
490
10.
, ,
.
,
. , AddWeb (http://www.cyberspacehq.com/) Register
Pro Promotion Spider (http://www.sharewarejunkies.com/9zwd11/register_pro.htm)
. , ,
. , , .
, .
.
, .
, . , , , ,
.
, . . , ,
- . ,
, . -, , , .
. ,
, . .
, :
, . ,
, ,
.
, ,
. , ,
. , , URL . ,
, -
, .
, .
13 .
,
, ( 1000 ) . ,
,
, . ,
- ,
( ).
,
,
,
.
, .
, .
.
, ? ()
.
(http://catalog.aport.ru/rus/thememap.aspx) .
. ,
, , , , , ,
.
, . , - , , ,
, . http://www.aport.ru/addurl.php,
.10.3.
491
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
. 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/).
493
494
10.
. 10.6. Up.ru
. , .
, . .
, . .
,
.
, , .
.
, -
, , . .
100, Mail.ru, SpyLOG .
, , , . , , .
- .
,
, .
, .
, , . , , -
, .
.
, , . ,
: , , ,
.
.
495
496
10.
, . ,
,
. , , , .
, , ,
.
. , , , . ,
, . , Rambler 60
, . , ,
.
.
100 (http://www.rambler.ru/).
.
, , . ,
Rambler .
Rambler 50,
20 . ,
1000
50 . , .
. 30.
, , , , , . ,
. 20-
,
.
.
,
, , , , .
, . ,
, , ,
.. ,
,
.
, ,
.
,
.
, , , .
,
, .
: 8888 8831 Rambler.
. , , . Rambler
. Rambler, .10.7, http://www.rambler.ru/doc/add_site.shtml.
Mail.ru (http://top.mail.ru/) (.10.8) ,
Rambler . , ,
.
.
. ,
,
( ). ,
497
498
10.
. 10.7. Rambler
. 10.8. Mail.ru
, . ,
Java- ( 1,5, ).
,
. , ,
Rambler, .
http://top.mail.ru/add.
SpyLOG (http://spylog.ru/), , .
. : , , , , .
http://stats.spylog.ru/add.phtml (.10.9).
. 10.9. SpyLOG
499
500
10.
.
,
. ,
;
.
.
. , , , , -.
,
.
. , , , .
, .
,
.
, .
.
. . ,
.
, : 57% . , .
.
,
.
. , ,
, ,
.
, , . , , , .
. ,
100 ,
90 .
.
, , . , .
.
, , CTR
. ,
,
(, ), , - .
, ,
.
,
. , , , ,
, , . , . , ,
, .
.
,
.
, ,
GIF JPEG, - . ,
501
502
10.
. ,
,
. 46860,
40050, 12060, 100100 8831. , .
,
( ). , , 46860 1015.
. . ,
, , , (
). , ,
.
. .
, ,
(CTR Click True Ratio) 0,2 3,5%, CTR 0,7%.
, 1% 100 .
? ,
, . , . 1%.
3% . , ,
. , , , .
, .
, . ,
, , .
, ,
. . ,
.
, , -
, , , , . ,
,
- ,
.
, .
.
. .
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 .
503
504
10.
,
http://webrating.ru.
,
. , ,
, .
, , 46860 . , ,
, , .
,
. 8831, . ,
. -
-. ,
. , .
. .
,
,
, ,
.
, ,
.
, . ,
.
.
, . : ,
, .
, , .
.
CGI-.
CGI- , -
. ,
. CGI (Common Gateway Interface) , .
,
.
505
506
10.
, , (
, ).
, -.
,
, , ,
. ,
, , , .
, , , , ,
.
CGI-.
http://www.download.ru/.
, ,
. , .
, : -,
; -, , .
, GuestBook.ru (http://www.
guestbook.ru/) Chat.ru (http://www.chat.ru/).
, , , , .
, , ,
. , ,
.
.
, , . , ,
: . ,
.
, . , . ,
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).
507
508
10.
, , , , . ,
.
,
, , .
, , . ,
. ,
,
, - .
, , .
, ,
, . , ,
. ,
.
, ,
, . , .
( )
. , .
, ,
.
.
, .
. CGI- . , ,
:
, ,
. ,
, .
, , , . ,
, , , , .. ,
, . ,
, .
, .
.
.
,
. , ,
.
, , , , , ..
, ,
. ,
. , -, , -, - . ,
.
, . , ,
. . , ,
509
510
10.
. , ,
. .
, : 1020
80 . , , . ,
, .
( 200300),
, . ,
, (
15).
, ,
, ( ) . ,
, .
- , .
, .
. ,
.
. , , ,
, . , .
: ,
, . .
, , ,
, ,
.
, ,
.
. -
,
.
. ,
. -, .
. -. , ,
..
,
.
, -
, . - ,
- .
, -
- (,
).
-,
.
-. - , ,
, .
. ,
, .
,
, - .
511
512
10.
. , , , . , , .
. , , .
, ,
, .
, ,
- ,
. .