Error: Unable to get value of the property 'checked': object is null or undefined


We have an application with the below java script code which is giving the error, unable to get the value of the property check box, we need to change the below code in the format <%=Checkbox1.ClientID%> format. Please help to change the below code in that format,

I have multiple lines of code like below, because of that I need to use predefined variable "crtlName"

var ctrlName="CheckBox"

if(document.getElementById(ctrlName + "1").checked)
document.getElementById(ctrlName + "Table1").style.display ='inline';

Durga Rao