// テキストフィールドに連動するcheckboxとradio function interlock() { $A(arguments).each(function(id){ var text = $('text_' + id); var box = $(id); box.onclick = function () { var text = $('text_' + this.id); text.style.color = this.checked ? '#333' : '#CCC'; if(this.checked) { text.focus(); } else { text.blur(); } } text.onfocus = function () { var box = $(this.id.replace(/text_/, '')); this.style.color = '#333'; box.checked = true; } text.onblur = function () { this.style.color = '#333'; } text.onchange = function () { var box = $(this.id.replace(/text_/, '')); } text.onchange(); }); } function IsArray(array) { return !( !array || (!array.length || array.length == 0) || typeof array !== 'object' || !array.constructor || array.nodeType || array.item ); }