Javascript-форум (https://javascript.ru/forum/)
-   Общие вопросы Javascript (https://javascript.ru/forum/misc/)
-   -   checkbox блокировка (https://javascript.ru/forum/misc/22492-checkbox-blokirovka.html)

bot87 22.10.2011 14:09

checkbox блокировка
 
<!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=utf-8" />
<title>Документ без названия</title>
</head>

<body>
<form>
<input type="checkbox" id="one1" onclick="aa()"  />
<input type="checkbox" id="one2"  />
<input type="text" id="one3" />
<input type="text" id="one4" />
<input type="submit" />
</form>
<script>
function aa(){
x=document.getElementsByTagName('input')
if(x[0].checked=true){
 x[1].disabled=true;
 }
}

</script>

</body>
</html>


Хочу чтобы при включении первого чекбокса второй блокировался но у меня здесь запара-невозможно отменить чекбокс!Помогите попраить код!

ksa 23.10.2011 09:39

Цитата:

Сообщение от bot87
при включении первого чекбокса второй блокировался

Как вариант...

<form>
<input type="checkbox" id="one1" onclick="aa(this.checked)"  />
<input type="checkbox" id="one2"  />
<input type="text" id="one3" />
<input type="text" id="one4" />
<input type="submit" />
</form>
<script>
function aa(Type){
   document.getElementById('one2').disabled=Type
}
</script>

bot87 23.10.2011 16:34

ksa пасиб!Научил!


Часовой пояс GMT +3, время: 03:24.