javascript with onclick="check()" problem
Posted: Fri Jan 07, 2011 2:06 am
i have the code:
and a submit button on the page.
the i also have the javascript code for the onclick="check()" :
so what all this means is i have two arrays of checkboxes for each product. as soon as i check any checkbox the submit button appears. i click on the submit button and i go to the next form. the problem now comes in if i click on the "back" button to go back to the previous page via the bwrowser..the submit button is disabled althou all my checkboxes that i checked, are still checked....i want the submit button to show???
please help??
thanks
Code: Select all
foreach($product_names as $product_row) { ?>
<tr>
<td > </td><td width='200px'><?php echo $product_row->getName();?></td>
<td width='200px'><input type="checkbox" name="graphic[]" value="<?php echo $product_row->getId();?>" onclick="check()"/></td>
<td width='200px'><input type="checkbox" name="text[]" value="<?php echo $product_row->getId();?>" onclick="check()"/></td>
</tr>
<?php } ?>the i also have the javascript code for the onclick="check()" :
Code: Select all
<html>
<head>
<script type="text/javascript">
function check()
{
var graphics = document.getElementsByName("graphic[]");
for(i=0;i<graphics.length;i++)
{
if(graphics[i].checked)
{
if(document.getElementById('submit').style.display=='none')
{
document.getElementById('submit').style.display='block';
}
}
}
var text = document.getElementsByName("text[]");
for(i=0;i<text.length;i++)
{
if(text[i].checked)
{
if(document.getElementById('submit').style.display=='none')
{
document.getElementById('submit').style.display='block';
}
}
}
}
</script>
</head>please help??
thanks