setting cookie works, but editing doesn't

Discussion in 'Perl Misc' started by ca@psver.net, Mar 1, 2006.

  1. Guest

    I'm using about 30 blocks with links on my page, that can be opened or
    closed by users so they're able to select which links should be
    displayed on their 'personal' page.

    Just closing blocks for the first time works fine, but returning
    visitors that want to open or close a new block, lose their first
    setting, everything in the cookie is replaced.

    I use this code, anyone got an idea? I spent days figuring it out! It
    drives me crazy!


    function toggle(t) {

    var para=document.getElementById(t);
    var tb = document.getElementById('t' + t);
    var htb = document.getElementById('h' + t);

    var v = GetCookieOpenClose('l');

    if(para.style.display!='none') {

    para.style.display = 'none';
    tb.style.display = 'block';
    htb.style.display = 'none';

    if (v!=null) {
    v += "|" + t;
    } else {

    v = "|" + t;
    }

    SetCookieOpenClose('l',v);

    }
    else {

    para.style.display = 'block';
    tb.style.display = 'none';
    htb.style.display = 'block';

    if (v!=null) {
    v = v.Replace("|" + t,"");
    }

    SetCookieOpenClose('l',v);

    }

    v = GetCookieOpenClose('l');

    return true;
    }
    , Mar 1, 2006
    #1
    1. Advertising

  2. wrote:
    > I'm using about 30 blocks with links on my page, that can be opened or
    > closed by users so they're able to select which links should be
    > displayed on their 'personal' page.
    >
    > Just closing blocks for the first time works fine, but returning
    > visitors that want to open or close a new block, lose their first
    > setting, everything in the cookie is replaced.
    >
    > I use this code, anyone got an idea? I spent days figuring it out! It
    > drives me crazy!


    You should have spent a minute figuring out an appropriate Usenet group.
    This group is about Perl.

    <JavaScript(?) code snipped>

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Mar 1, 2006
    #2
    1. Advertising

  3. Tintin Guest

    <> wrote in message
    news:...
    > I'm using about 30 blocks with links on my page, that can be opened or
    > closed by users so they're able to select which links should be
    > displayed on their 'personal' page.
    >
    > Just closing blocks for the first time works fine, but returning
    > visitors that want to open or close a new block, lose their first
    > setting, everything in the cookie is replaced.
    >
    > I use this code, anyone got an idea? I spent days figuring it out! It
    > drives me crazy!
    >
    >
    > function toggle(t) {
    >
    > var para=document.getElementById(t);
    > var tb = document.getElementById('t' + t);
    > var htb = document.getElementById('h' + t);
    >
    > var v = GetCookieOpenClose('l');
    >
    > if(para.style.display!='none') {
    >
    > para.style.display = 'none';
    > tb.style.display = 'block';
    > htb.style.display = 'none';
    >
    > if (v!=null) {
    > v += "|" + t;
    > } else {
    >
    > v = "|" + t;
    > }
    >
    > SetCookieOpenClose('l',v);
    >
    > }
    > else {
    >
    > para.style.display = 'block';
    > tb.style.display = 'none';
    > htb.style.display = 'block';
    >
    > if (v!=null) {
    > v = v.Replace("|" + t,"");
    > }
    >
    > SetCookieOpenClose('l',v);
    >
    > }
    >
    > v = GetCookieOpenClose('l');
    >
    > return true;
    > }


    You need to fix all your Perl errors first.

    $ perl -cw foo
    Unquoted string "t" may clash with future reserved word at foo line 1.
    Unquoted string "document" may clash with future reserved word at foo line
    3.
    Unquoted string "t" may clash with future reserved word at foo line 3.
    Unquoted string "document" may clash with future reserved word at foo line
    4.
    Unquoted string "t" may clash with future reserved word at foo line 4.
    Unquoted string "document" may clash with future reserved word at foo line
    5.
    Unquoted string "t" may clash with future reserved word at foo line 5.
    Unquoted string "para" may clash with future reserved word at foo line 9.
    Unquoted string "style" may clash with future reserved word at foo line 9.
    Unquoted string "display" may clash with future reserved word at foo line 9.
    Unquoted string "para" may clash with future reserved word at foo line 11.
    Unquoted string "style" may clash with future reserved word at foo line 11.
    Unquoted string "display" may clash with future reserved word at foo line
    11.
    Unquoted string "tb" may clash with future reserved word at foo line 12.
    Unquoted string "style" may clash with future reserved word at foo line 12.
    Unquoted string "display" may clash with future reserved word at foo line
    12.
    Unquoted string "htb" may clash with future reserved word at foo line 13.
    Unquoted string "style" may clash with future reserved word at foo line 13.
    Unquoted string "display" may clash with future reserved word at foo line
    13.
    Unquoted string "v" may clash with future reserved word at foo line 15.
    Unquoted string "null" may clash with future reserved word at foo line 15.
    Unquoted string "v" may clash with future reserved word at foo line 16.
    Unquoted string "t" may clash with future reserved word at foo line 16.
    Unquoted string "v" may clash with future reserved word at foo line 19.
    Unquoted string "t" may clash with future reserved word at foo line 19.
    Unquoted string "v" may clash with future reserved word at foo line 22.
    Unquoted string "para" may clash with future reserved word at foo line 27.
    Unquoted string "style" may clash with future reserved word at foo line 27.
    Unquoted string "display" may clash with future reserved word at foo line
    27.
    Unquoted string "tb" may clash with future reserved word at foo line 28.
    Unquoted string "style" may clash with future reserved word at foo line 28.
    Unquoted string "display" may clash with future reserved word at foo line
    28.
    Unquoted string "htb" may clash with future reserved word at foo line 29.
    Unquoted string "style" may clash with future reserved word at foo line 29.
    Unquoted string "display" may clash with future reserved word at foo line
    29.
    Unquoted string "v" may clash with future reserved word at foo line 31.
    Unquoted string "null" may clash with future reserved word at foo line 31.
    Unquoted string "v" may clash with future reserved word at foo line 32.
    Unquoted string "v" may clash with future reserved word at foo line 32.
    Unquoted string "t" may clash with future reserved word at foo line 32.
    Unquoted string "v" may clash with future reserved word at foo line 35.
    Unquoted string "v" may clash with future reserved word at foo line 39.
    Unquoted string "true" may clash with future reserved word at foo line 41.
    syntax error at foo line 1, near ") {"
    syntax error at foo line 42, near "}"
    foo had compilation errors.
    Tintin, Mar 2, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Hammond
    Replies:
    2
    Views:
    4,518
    bruce barker
    Nov 14, 2003
  2. F. GEIGER
    Replies:
    3
    Views:
    768
    F. GEIGER
    Aug 6, 2004
  3. Replies:
    0
    Views:
    585
  4. Timur Tabi
    Replies:
    1
    Views:
    121
    Timur Tabi
    May 14, 2004
  5. Replies:
    1
    Views:
    81
    Thomas 'PointedEars' Lahn
    Mar 2, 2006
Loading...

Share This Page