cocher décocher plusieurs cases a cocher
Bonjour, voici mon probleme,
je veux cocher et decocher plusieurs case a cocher en selectionnant une case.
tout mache a merveille, mais ce que j'arrive pas a comprendre, c que une fois, je mets le tout dans une balise <table> alors là, c la cata. rien ne marche : voici mon code
ce code marche bien :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<?php
include "connexion.php";
$sql="select * from t_annonce";
$result=mysql_query($sql);
?>
<script type="text/javascript">
function GereChkbox(conteneur, a_faire) {
var blnEtat=null;
var Chckbox = document.getElementById(conteneur).firstChild;
while (Chckbox!=null) {
if (Chckbox.nodeName=="INPUT")
if (Chckbox.getAttribute("type")=="checkbox") {
blnEtat = (a_faire=='0') ? false : (a_faire=='1') ? true : (document.getElementById(Chckbox.getAttribute("id")).checked) ? false : true;
document.getElementById(Chckbox.getAttribute("id")).checked=blnEtat;
}
Chckbox = Chckbox.nextSibling;
}
}
//-->
</script>
<form method="post" action="">
<input type="checkbox" onClick="GereChkbox('div_chck','1');" />
<div id="div_chck">
<?php while($row=mysql_fetch_array($result)){ ?>
<input name="checkbox<? echo ''.$row['Id'].''; ?>" type="checkbox" id="checkbox<? echo ''.$row['Id'].''; ?>" value="<? echo ''.$row['Id'].''; ?>" /><?php echo ''.$row['Id'].''; ?>
<?php } ?>
</div>
</form> |