|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
displaying 10 rows in each page and creates a new form if it exceeds that page
I'm trying to create a form that does the following in jsp/javascript
Displays 10 rows, each row containing a record if records exceeds 10, it will display the remaining records on another page.The first form will contain a link to the second form and the second form will contain the link to the first. So basically there could be infinite number of forms containing 10 rows each on each form each displaying a link to the other forms. Help ![]() |
|
#2
|
|||
|
|||
|
not jsp/javascript, but maybe it helps ...
Code:
$index = $q->params('i'); #first page is called with i=1
$max = ???; #number of rows
$MAXROWS = 10;
$end = $max;
$next = 0;
if (($max - $index) >= $MAXROWS) {
$end = $index + $MAXROWS - 1;
$next = 1;
}
#rows
for ($i = $index; $i <= $end; $i++) {
print $rows[$i - 1]; #if first elements index is 0
}
#prev-link
if ($index > 1) {
$j = $index - $MAXROWS;
if ($j < 1) {
$j = 1;
}
print "<a href='http://url?i=$j'>Prev</a>";
}
#direct links
if ($max > $MAXROWS) {
for ($i = 1; $i <= $max; $i = $i + $MAXROWS) {
if (($i >= $index) && ($i < ($index + $MAXROWS))) {
print " $i "; #actual page is not a link
} else {
print " <a href='http://url?i=$i'>$i</a> ";
}
}
}
#next link
if ($next) {
print "<a href='http://url?i=" . ($end + 1) . "'>Next</a>";
}
sorry, but i had no time to test the code. maybe you have to add somewhere a +/- 1 or so Last edited by Hermetiker : February 27th, 2002 at 07:57 AM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > displaying 10 rows in each page and creates a new form if it exceeds that page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|