����� 4
�� 4: ����� ������ �� ������ � ���� ����� ���?
�� �� ��� ���� ������ ����� ���� �� ������� ���. �� �� ���� ���� ����� ��� ����� ������� �����, ��� ������ �� ������ ������ ������ �-src �� ������� ������ ��� ������:
var an_image = new Image();
an_image.src = "my_nice_image.gif";
����� ��� �- ".src" �� ������ ����� ����� ����� ������� �� ������ ����� ����� �� �����, �����, �����, ��-cache ����. ������ ����� ���� ����� ����� ����� ������ On-line.
���, ��� ����� �� ����� ��� �������� ����. ������ ������ ������ ������ �� ���.
���
�����
����
���� ���� ����� ����� ��� ��� ����� ������ ������� ������ ���� ������ ���� ������� �� ��� ������, ���� �� ����� ���� �� ������. �������, �� �� ����. ���� ������ �� ����� ������ �������� ����� onLoad, ��� ���� ���� ����� ����� ������. �� �� �� ��� ����� ��� ���� ��:
<body onLoad="doPreload();">
������� �- ()doPreload ���� ���� ����� ����� ������. ���� ���� ��������� ��� ������� ������ ���� ��:
function doPreload()
{
var the_images = new Array('stuff3a/kwmatt.jpg','stuff3a/matbon.jpg','stuff3a/lunchMat.jpg');
preloadImages(the_images);
}
function preloadImages(the_images_array)
{
for(loop = 0; loop < the_images_array.length; loop++)
{
var an_image = new Image();
an_image.src = the_images_array[loop];
}
}
���� ����� �� onLoad � ����� ������ �������� - ���� ������, �������� ()doPreload ����� ���� ����� ����� ������. ()doPreload ���� ���� ������ �� ���� ������ ������ ������ ������ �� ���� ������� � - ()preloadImages, ��� ������ ������ ��� ���� �������. �� �� ���� ��� ������ , ��� ���� ������� ����� ��� ����� ����� �-src �� ���� ������� ������.
�� ��� ����,��? ���� ������� ����� ��� �� ������, ����? ��� ��� ���� ���� ��, ���� ������ �� ���� ������ ������ ����� ��� ���������. �� ����� �����, ���� ������ ��� ��� ���� ����� ���� �� ����� ���������.
���� ������ ���
��� ��� «--
|