Null or not an object error!

The following code

for (var x = 0; x < document.forms[0].Hazards.length; x++)

{

if(document.forms[0].Hazards.checked)

document.forms[0].BLAH.value = document.forms[0].Hazards.value;

}

gives me a null or not an object error… i tried to click “generate HTML for all fields” but that doesnt help either. Can someone help me out? Thanks all.