Hi

I'm trying to write a script to disable a couple of fields when a checkbox is ticked.

The following script triggered by an "onchange" call on the checkbox works, but seemingly only if the fields I'm trying to disable follow after the tickbox on the form.
Code:
<script language="javascript" type="text/javascript">
function enabledisable()  
{
if (document.form1.field1.disabled==true) {
	document.form1.field1.disabled=false;
	document.form1.field2.disabled=false;
	}
	else 
		{document.form1.field1.disabled=true;
		document.form1.field2.disabled=true;	
	}
}

</script>
How would I modify this script to allow me to disable fields which appear before it on the form?