www.webdeveloper.com
Results 1 to 4 of 4

Thread: quicklist help

  1. #1
    Join Date
    Mar 2010
    Posts
    3

    quicklist help

    I am trying to code a quicklist for my site I am have a little trouble I can add a element in a array but when removing it is not working I have posted the code below any help guys
    Code:
    <script type="text/javascript">
    var propList;
    var curPos;
    var curSize;
    var propList = [];
    function addProperty(propNum) {
     if (curSize == 0) {
       propList[0] = propNum;
     }else {
      propList.push(propNum);
      curSize = propList.length;
      document.getElementById('snum').value = propList.length;
      document.getElementById("snum").style.display = "";
      document.getElementById("snum1").style.display = "";
      sessvars.saveList = propList;
    }}
    
    function removeProperty(propNum) {
    propList = sessvars.saveList;
    alert('deleting: ' + propNum);
    curPos = 0;
    while (curPos <= propList.length) {
    // alert('entered loop');
      if (propList[curPos] == propNum) {
             propList[curPos] = null;
            alert('found propertid ' + propNum + ' at position ' + curPos);
    }
    curPos=curPos+1;
    }
     sessvars.saveList = propList;
    
      listProperty();
    }
    </script>
    Last edited by Kor; 03-01-2010 at 02:18 PM. Reason: wrap the code [code][/code]

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    We can not see where you have set the sessvars object and its saveList property/method. Anyway, I suspect that you try to modify the local reference of a variable instead of the global variable itself. Or you have created a simple variable instead of an object. I need more details, please.

  3. #3
    Join Date
    Mar 2010
    Posts
    3
    hi thanks for your responce


    I am using a sript called sessvars so I can acess Session variables without cookies found at:


    http://www.thomasfrank.se/sessionvars.html



    using this syantax

    sessvars.myObj

  4. #4
    Join Date
    Mar 2010
    Posts
    3
    Forgot to mention the script works if there is more than one item in array but last item does not delete

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles