Author Topic: offset page and limit , The beginning of a long story  (Read 1410 times)

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
  • Posts: 1895
    • View Profile
offset page and limit , The beginning of a long story
« on: October 23, 2007, 09:06:00 PM »
By amusement I recovered of the javascript code and I recreated what follows:

insert all section [sym-url] at the end of your template and add %sym-url% anywhere into the [files] and [nofiles] sections (Rather in the beginning of section)

It is not the best possible code but that works.

 Activate checkboxes and modify the possible values (when logged its better)

( Noted: and page is not activated)
It is the beginning, later I attack the presentation


<script language="javascript" type="text/javascript">
var code_value = new Array();

code_value["offset"] = "0";
code_value["page"] = "1";
code_value["limit"] = "-1";

function changeurl(code){
    var check=0;

    switch (code)
        case 4 : code="offset"; check=1; break;
        case 5 : code="page"  ; check=1; break;
        case 6 : code="limit" ; check=1; break;
                   default : check=0; break;

    var valeur = document.form.champ.value;

   if(code == "recursive" )
          {  if ( != -1)
       { valeur = valeur.replace(code,'');
          document.form.champ.value = valeur;
                   { document.form.champ.value= code+valeur}


 else   if ('='+code_value[ code ]) != -1)  {              //le champ existe
             if (check == 1){                                                               //mise à jour des valeurs
                valeur = valeur.replace('&'+code+'='+code_value[ code ],'')
                document.form.champ.value = valeur+'&'+code+'='+document.form.elements[ code ].value;
            else  {
                valeur = valeur.replace('&'+code+'='+document.form.elements[ code ].value,'');
                document.form.champ.value = valeur;
         else {
            if (check==0){
                      document.form.champ.value += '&'+code+'='+document.form.elements[ code ].value;


    <form name="form">
       <input type="text" name="champ" size="50"><br/>
       <input type="checkbox" name="cocher" value="1"  onclick="changeurl('offset');">offset
       <input type="checkbox" name="cocher" value="2"  onclick="changeurl('page');">page
       <input type="checkbox" name="cocher" value="3"  onclick="changeurl('limit');">limit
       <input type="checkbox" name="cocher" value="recursive"  onclick="changeurl('recursive');">recursive
       <input type="text" name="offset" size="4" value="0" onchange="changeurl(4);" onKeyup="changeurl(4);">

       <select name="page"  size="1" onchange="changeurl(5);" >
         <option value="1" selected>1
         <option value="2">2
         <option value="3">3
         <option value="4">4
         <option value="5">5
         <option value="6">6
         <option value="7">7
         <option value="8">8
         <option value="9">9
         <option value="10">10

       <select name="limit"  size="1" onchange="changeurl(6);">
         <option value="-1" type="hidden" selected>0
         <option value="5">5
         <option value="10">10
         <option value="15">15
         <option value="20">20
         <option value="25">25
         <option value="30">30
         <option value="35">35
         <option value="40">40
         <option value="45">45
         <option value="50">50
<INPUT TYPE="button" VALUE="Actualiser" onClick="window.location.href=''+document.form.champ.value">

ref to read
« Last Edit: October 23, 2007, 09:10:32 PM by mars »