��� ����: ����� ����� / ����� 4 / �� 6
 


������ �� ��� �- JavaScript
 


���� ������ ��:
1: ����� ������ 4
2: ���� �������
3: ������ �����
4: ��� �� ������ while
5: ������ for
6: ������ �������
7: ������ ������
8: ������
9: ������ �������
10: ������ �- DOM
11: ��������
12: �������� void
13: �������
14: �������� �������
15: ����� ��������
16: ����� ����� 4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

����� 4

�� 6: ������ �������.

��� ����:


var height = prompt("How high do you want the grid? (1-10 is good)","10");
var width= prompt("How wide do you want the grid? (1-10 is good)","10");
var a_line;
var new_window = window.open("Files\Grid.html","looper","width=400,height=400");
new_window.document.writeln("<h1>A Grid</h1>");
for (height_loop = 0; height_loop < height; height_loop++)
{
  a_line = "";
  for (width_loop = 0; width_loop < width; width_loop++)
  {
    a_line+="x";
  }
  new_window.document.writeln(a_line + "<br>");
}
                

���� ����� ����� ������ �������, ����� ���� ���, ������ ����� ������, ����� ������ ������� �-for. ����� �-for ������� ����� ""=a_line. ��� ����� �� ���� ��� ���� �� ����� �� �����. ���� ����� a_line, �- script ���� ������ for ����, �� ��� ����� ���� �� x-��, ���� ��� ������, ������� ����� ����. �� ���� height �����.

���, ������ ��� ����� ����� ���� ��� �����, ���� ������ ���� �� ��� ����� ��� �� �����.

���� ������ ���

��� ��� «--

 
       
       
   
 
 

���� ����
����� �����
����� �����
����� ������
����� ���
��� ����