Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:44:55+00:00 2026-06-09T17:44:55+00:00

I meet a problem with a script i’m doing. actually I gave something like

  • 0

I meet a problem with a script i’m doing. actually I gave something like that because I’m doing a mail box for my intranet.

<script type="text/javascript">
function GereChkbox(conteneur, a_faire) {
var blnEtat=null;
var Chckbox = document.getElementById('box-table-a').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>
<table width="100%" border="0" id='box-table-a'>
  <tr>
    <th scope="col" width="15%"><strong>Exp&eacute;diteur</strong></th>
    <th scope="col" width="60%"><strong>Message</strong></th>
    <th scope="col" width="10%"><strong>Date</strong></th>
    <th scope="col" width="15%"><strong>Actions</strong></th>
  </tr><?php $sql="SELECT * FROM `messages` WHERE `id_destinataire`='".$_SESSION['login']."' AND `trash`='0' ORDER BY id DESC LIMIT ".$premiereEntree.", ".$messagesParPage."" ;
$result=mysql_query($sql) or die(__LINE__.mysql_error().$sql);
$i=0; 
while($data=mysql_fetch_assoc($result)) {                                                ?>
<tr>
<td align="left"><?php $req="SELECT * FROM `gestionnaire` WHERE `login`='".$data['id_expediteur']."'";
$result2=mysql_query($req) or die(__LINE__.mysql_error().$req);
$expediteur=mysql_fetch_assoc($result2);  ?><img src="<?php if (!empty($expediteur['urlavatar'])) {echo $expediteur['urlavatar']; } else {echo "images/noAvatar.gif" ;} ; ?>" width="50px" height="50px" /><br /><?php echo $expediteur['nom'].' '.$expediteur['prenom'] ; ?></td>
<td><?php if($data['lu']=='0') { echo '<p align="left"><img src="images/Gnome-Mail-Unread-32.png" width="24px" height="24px" /><strong>  '.$data['titre'].'</strong></p>';
$nbChar = 150; // Nb. de caractères sans '...'

if(strlen($data['message']) >= $nbChar)
    $message = substr($data['message'], 0, $nbChar).' [...]';

echo '<p align="left"><i>'.$message.'</i></p>';
}
else { echo '<p align="left"><img src="images/Gnome-Emblem-Mail-32.png" width="24px" height="24px" /><strong>  '.$data['titre'].'</strong></p>';
$nbChar = 150; // Nb. de caractères sans '...'

if(strlen($data['message']) >= $nbChar)
    $message = substr($data['message'], 0, $nbChar).' [...]';

echo '<p align="left"><i>'.$message.'</i></p>';} ;
?></td>
<td><?php echo  date('d-m-Y H:i',strtotime($data["date"])) ; ?></td>
<td><a href="index.php?p=liremessage&amp;id=<?php echo $data['id'] ; ?>"><img src="images/email_open.png" alt="Lire le message" width="24px" height="24px" border="0"  /></a> <img src="images/Gnome-Mail-Forward-32.png" alt="Transf&eacute;rer le message" width="24px" height="24px" border="0"  /> <a href="deletemessage.page?id=<?php echo $data['id'] ; ?>" onclick="return confirm('Voulez vous vraiment supprimer ce message?')"><img src="images/mail-trash.png" alt="Supprimer ce message" width="24px" height="24px" border="0"  /></a> <input type="checkbox" name="action[<?php echo ++$i; ?>]" id="checkbox<?php echo $i; ?>"  /></td>
</tr>
<?php } ; ?>
</table>
<table width="100%" border="0">
  <tr>
    <td>Actions: <input type="button" value="Tout cocher" onClick="GereChkbox('div_chck','1');">&nbsp;&nbsp;&nbsp;
<input type="button" value="Tout d&eacute;cocher" onClick="GereChkbox('div_chck','0');">&nbsp;&nbsp;&nbsp;
<input type="button" value="Inverser la s&eacute;lection" onClick="GereChkbox('div_chck','2');"></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>

In fact it does not really work because of the script and I have no error messages in the console.

Thank you verry much in advance for your help.

Kind regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:44:56+00:00Added an answer on June 9, 2026 at 5:44 pm

    Anyway, here’s a function that toggles / checks / unchecks any checkboxes given to it:

    function changeCheckboxes(list, value){
        for(var i = list.length - 1 ; i >=0 ; i--){
            list[i].checked = (typeof value === 'boolean') ? value : !list[i].checked ;
       }
    }
    

    It accepts a nodelist or array of checkboxes as the first parameter. Use it as follows…

    Toggle Checkboxes:

    changeCheckboxes(allCheckboxes);

    Check Checkboxes:

    changeCheckboxes(allCheckboxes, true);

    Uncheck Checkboxes:

    changeCheckboxes(allCheckboxes, false);

    To get allCheckboxes, you can do this:

    var inputs = document.getElementsByTagName('input');
    var allCheckboxes = [] ;
        for (var j = inputs.length-1 ; j >= 0 ; j--){
            if (inputs[j].type === 'checkbox'){
            allCheckboxes.push(inputs[j]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I meet a problem yesterday. Maybe it's because it is April 1st... but it
I meet a problem about type contraint of c# now. I wrote a pair
i have a script that i have modified to meet my requirements however i
I meet a problem about: Object of type 'System.Int64' cannot be converted to type
I meet a problem that my page works well in firefox and chrome(almost the
I meet a problem like this: UPDATE class A { public: A(){} int i;
I meet a problem that when I run clearcase command: ct find . -branch
I have a Rails script that I would like to run daily. I know
I am new on Symfony and I meet the following problem. I'd like to
I recently meet a problem when copying dynamically allocated data in device to host

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.