動作する例を次に示します (必要に応じて変更する必要があります)。
<script type = "text/javascript">
function checkboxes()
{
if(document.getElementById('checkbox_1_id').checked&&document.getElementById('checkbox_2_id').checked == false)
{
document.getElementById('textarea_id').value = "First checkbox has been checked";
}
else if(document.getElementById('checkbox_1_id').checked == false&&document.getElementById('checkbox_2_id').checked)
{
document.getElementById('textarea_id').value = "Second checkbox checked";
}
else if(document.getElementById('checkbox_1_id').checked&&document.getElementById('checkbox_2_id').checked)
{
document.getElementById('textarea_id').value = "Both checkboxes checked";
}
}
</script>
<input type = "checkbox" id = "checkbox_1_id" >
<input type = "checkbox" id = "checkbox_2_id" >
<input type = "button" onclick = "checkboxes()" value = "defend">