Code: Select all
On form load I am trying to pre-check the antivirus checkbox if $result2[30] is equal to 'Yes'. I have tried using the window.onload function but with no results so far. Is there something I have missed or am I going about it the wrong way.
Any suggestions would be greatly appreciated thanks
<script type="text/javascript">
window.onload = function(){
if(document.form.$result2[30]=='Yes'){
document.form.antivirus.checked == true;
}
}
</script>
<input type="hidden" name="antivirus" value="<?php echo $result2[30]; ?>"/>
<tr>
<td><label>Antivirus:</label> <?php echo $result2[30]; ?></td>
<input type="hidden" id="Antivirus" name="antivirus" value="No"/>
<td>
<input type="checkbox" id="Antivirus" name="antivirus" value="Yes"/>