��� ����: ����� ����� / ����� 5 / �� 8
 


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


���� ������ ��:
1: ���� ������ 5
2: ���� ������
3: ���������� �����
4: ����� ���� �����
5: ���� �����
6: ������� ���� �����
7: CheckBoxes
8: ������ ����
9: ������
10: ����� onChange
11: ����� �� ����� 5
|
|
|
|
|
|
|
|
|
|
|
|

����� 5

�� 8: ������ ����.

������, ������ ����� ���� ���� �- checkbox ������ ���� �� JavaScript. ����� ������ ������ ��� ���� �- HTML. �- checkboxes ����� �������� �������� ����� ������� ����. �� �- checkbox ���� �������� ���� �� ������ �����. ������ ����� ����� ���. ���� ������ ���� ���� ��� ���� ���� �� ������ ��� ����, ��� ������ ������ ���. ����� ������ ������.

Larry
Moe
Curly

��� ���� ����, ��� ���� ����� �� ����� ����� ������, �� ���� ���� ���� ������ ���. ���� ������ �� �� ���, ��� ������ ����� �� ������� ��� ������ �� ������ ����� ����� checkbox ���:

Light off
Light on

�����, ������ ��"� ���� ���� ������ �� �- checkboxes. ��� ��� �����:

<form name="form_1">
  <input type="radio" name ="radio_1" onClick="offButton();">Light off
  <input type="radio" name ="radio_2" onClick="onButton();" checked>Light on
</form>

���� ����� ����� ������ ���� �������� offButton() ����� ������. ��� ��������:

function offButton() {   var the_box = window.document.form_1.radio_1;
  if (the_box.checked == true) {
    window.document.form_1.radio_2.checked = false;
    document.bgColor='black';
    alert("Hey! Turn that back on!");
  }
}

���� ���� ������ �� �- checkbox ����, ����� ������ ��� ����� ���:

window.document.form_1.radio_2.checked = false;

��� �� ���� �- JavaScript ����� �� �������� ������ ���� ����� �� ����. �������� ������� ���� ������ ���� ������ ����, ���� ���� �������� ������:

function onButton()
{
  var the_box = window.document.form_1.radio_2;
  if (the_box.checked == true) {
    window.document.form_1.radio_1.checked = false;
    document.bgColor='white';
  alert("Thanks!");
  }
}

���� ��� ��� ����� ����� checkboxes ������� �����, ��� �� ���� ������ ���. ���, ����� ���� ������ �� ������ �����: ������.

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

��� ��� «--

 
       
       
   
 
 

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