����� 5
�� 8: ������ ����.
������, ������ ����� ���� ���� �- checkbox ������ ���� �� JavaScript. ����� ������ ������ ��� ���� �- HTML. �- checkboxes ����� �������� �������� ����� ������� ����. �� �- checkbox ���� �������� ���� �� ������ �����. ������ ����� ����� ���. ���� ������ ���� ���� ��� ���� ���� �� ������ ��� ����, ��� ������ ������ ���. ����� ������ ������.
��� ���� ����, ��� ���� ����� �� ����� ����� ������, �� ���� ���� ���� ������ ���. ���� ������ �� �� ���, ��� ������ ����� �� ������� ��� ������ �� ������ ����� ����� checkbox ���:
�����, ������ ��"� ���� ���� ������ �� �- 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 ������� �����, ��� �� ���� ������ ���. ���, ����� ���� ������ �� ������ �����: ������.
���� ������ ���
��� ��� «--
|