By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,246 Members | 1,747 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,246 IT Pros & Developers. It's quick & easy.

Paging using java script and i really need help

P: 1
Hi!!

I'm trying to do some simple paging with goes to the database once and then shows and hides the results to display 3 items at a time. It uses a next and previous button. The next button works but the previous button displays all previous results and not just the last three results.

What i need it to do is hide all results and show the last three
This is my code and i really do need a little help pleaaaaaase!!

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT>
  2. var intPosition=0;
  3. function ShowFirstThreeItems()
  4. {
  5.     var i;
  6.     i=1;
  7.     for (i=1; i<=3; i++) 
  8.     {
  9.     eval('ItemRow'+i+'.style.display="block"');
  10.     intPosition=i;
  11.  
  12.     }
  13. }
  14. function showNext()
  15. {
  16.  
  17.     var i;
  18.  
  19.     for (i=1; i<=intPosition; i++) 
  20.     {
  21.     eval('ItemRow'+i+'.style.display="none"');
  22.     }
  23.     for (i=intPosition+1; i<=intPosition+3; i++) 
  24.     {
  25.     eval('ItemRow'+i+'.style.display="block"');
  26.     }
  27.     intPosition=i-1
  28.  
  29.  
  30. }
  31.  
  32.  
  33. function showPrev()
  34. {
  35.  
  36.     var i;
  37.  
  38.  
  39.     for (i=intPosition; i>0; i--)
  40.     {
  41.     eval('ItemRow'+i+'.style.display="block"');
  42.     }
  43.     for (i=intPosition+1; i<=intPosition-1; i--) 
  44.     {
  45.     eval('ItemRow'+i+'.style.display="none"');
  46.     }
  47.     intPosition=i-3
  48.  
  49.  
  50. }
Aug 8 '06 #1
Share this Question
Share on Google+
1 Reply


P: 1
Hello, I think U got your answer. But will u please help me out..
I also need the paging in java script..& my back end is PGSQL.
Will u please send me the code of that?...
Jul 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.