Edit in JSFiddle

<p>
    <input id="SampleCheckboxWithoutLabel" type="checkbox" />
    Sample Checkbox Without Label
</p>
<p>
    <input id="SampleCheckboxWithLabel" type="checkbox" />
    <label for="SampleCheckboxWithLabel">Sample Checkbox With Label</label>
</p>
<p>
    <label for="SampleCheckboxInsideLabel">
        <input id="SampleCheckboxInsideLabel" type="checkbox" />
        Sample Checkbox Inside Label
    </label>
</p>
<p>
    <label>
        <input type="checkbox" />
        Sample Checkbox Without ID
    </label>
</p>
$$('input').addEvent('click', function() {
    alert(this.id);
});