Haz intentado pasar todo a php?
Código php:
Ver original$uno = (in_array(1, $array)?
'checked="checked"':''); $dos = (in_array(2, $array)?
'checked="checked"':''); $tres = (in_array(3, $array)?
'checked="checked"':''); $cuatro = (in_array(4, $array)?
'checked="checked"':'');
$html = '
<html>
<body>
<form>
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">Checks seleccionados hasta ahora: </td>
</tr>
<tr>
<td>Uno</td>
<td><input type="checkbox" name="1" value="1" '.$uno.' /></td>
</tr>
<tr>
<td>Dos</td>
<td><input type="checkbox" name="2" value="2" '.$dos.' /></td>
</tr>
<tr>
<td>Tres</td>
<td><input type="checkbox" name="3" value="3" '.$tres.' /></td>
</tr>
<tr>
<td>Cuatro</td>
<td><input type="checkbox" name="4" value="4" '.$cuatro.' /></td>
</tr>
</table>
<form>
</body>
</html>';
print $html;
Suerte!