Всем привет 
Написал код в качестве примера:
| Код | <html> <head> <title>Just an example :)</title> <script type="text/javascript">
var a1=new Array(); function run(){ var b1, b2, a2, e='px'; b1=new Array('123','132','213','231','312','321'); b2=new Array('ABC','ACB','BAC','BCA','CAB','CBA'); for (var i=0; i<b1.length; i++){ a1[i]=document.createElement('input'); a1[i].style.position='absolute'; if (i) {a1[i].style.width=30+e; a1[i].disabled=true;} else {a1[0].type='checkbox'; /* a1[0].onclick=config() */ } a1[i].style.left=50+e; a1[i].style.top=50+i*25+e; a1[i].value=b1[i]; a1[i].style.backgroundColor='EEEEFE'; document.body.appendChild(a1[i]); a2=document.createElement('input') a2.style.position='absolute'; a2.style.width=30+e; a2.style.left=90+e; a2.style.top=50+i*25+e; a2.style.border=0; a2.value=b2[i]; a2.disabled=true; document.body.appendChild(a2); } }
function config(){ for (i=1; i<a1.length; i++) a1[i].disabled!=a1[0].checked; }
</script> </head> <body onload='run()'> </body> </html>
|
Вопрос: как мне посадить в 15 строке onclick() на a1[0] и вызвать ф-цию config()?? Если "раскомментировать", то дебаггер ругается: "Ошибка в 14й строке: не реализована" |