1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

new to java, need help with this code to set cookie

Discussion in 'Java' started by Taurus MFF, Jun 7, 2010.

  1. Taurus MFF

    Taurus MFF New Member

    Jun 6, 2010
    Likes Received:
    Trophy Points:
    we had a feature to be able to open/close a block of text on our site. the user's selection (expand or collapse) gets stored in a cookie.

    we have since removed the feature to open/close the block. the problem is that anyone who had the block closed before we removed the open/close feature does not see the block.

    we need to replace the existing cookie and set the new cookie to contain the correct value to open (expand) the block.

    following is the part of code which set the original cookie. how do I modify this to expire the existing cookie and set the new one to expand the block? do I just set var A=1 and change the getTime()+ statement?

    var A=fetch_cookie("vbulletin_sidebar_collapse");if(A=="1"){this.collapse(false)}};vBSidebar.prototype.toggle_collapse=function(A){YAHOO.util.Event.stopEvent(A);if(YAHOO.util.Dom.getStyle(this.sidebar,"display")=="none"){this.expand()}else{this.collapse(true)}return false};vBSidebar.prototype.collapse=function(A)


    {expires=new Date();expires.setTime(expires.getTime()+(1000*86400*365));set_cookie("vbulletin_sidebar_collapse",A,expires)};
    thank you for your help!


Share This Page