views:

294

answers:

4

Hi,

In GMail, the mails are listed. When we we have lots of mails (ex:50), we can select and go to next page, select some more mail, and come back to page 1. But whatever mails the user checked will still be checked.

I just want to implement the same operation. How would I do that?

Thanks, Krish

Note: I don't want to use AJAX. I'd rather use Javascript, CGI, PERL, etc.

+2  A: 

Simple in theory. Just store the ids of checked mail in a JavaScript variable and/or cookie, and let them access (via AJAX) as many checkbox lists as they want, before submitting.

Matthew Flaschen
i dont want use AJAX NEED USE CGI , PERL
joe
A: 

After every time a user selects an email, add the message id to some array in a cookie (you probably want to preform this on-the-fly, with AJAX).

When you load a page with mail, check if the message id has been already checked, and if so, change the default state to checked.

daniel
NO AJAX. I can use CGI , PERL , JAVASCRIPT , HTML Templete
joe
+1  A: 
  1. <input type="checkbox" onclick="toggleValue(this)"> and in handler check the value and store it in array.

  2. JQuery

    $('input[type=checkbox].mail').click(
        function()
        {
            if (this.checked) $(this).addClass('checked');
            else $(this).removeClass('checked');
        }
    );
    $('input[type=checkbox].mail.checked').each(function_here);

Can have some typos in the second one...

PS: don't know why, but the code above is not being formatted (

Jet
Some What OK ... I am not able get the complete code ..
joe
A: 

I Just found the way of doing this using Java Script( no external Program ) and URL Parameters , onclick events , onload events , location.href, using global variable ,read form

joe