473,472 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Setting cookie works, editing doesn't

ca
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 '06 #1
1 1106
ca@psver.net wrote:

[pretty printed:]
function toggle(t)
{
var para= document.getElementById(t);
var tb = document.getElementById('t' + t);
var htb = document.getElementById('h' + t);
You have feature-tested the method before you call it, yes?
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;
}


Now that you have posted which methods you call to set and retrieve cookie
data, it is time that you post their code (because they are not built-ins),
and say what exactly does not work in what way.
PointedEars
Mar 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Jochen Daum | last post by:
Hi! I have a function in a lot of pages, which redirects to a new page, if a form has been submitted: if (!(defined("DEBUG_INSERT") && DEBUG_INSERT) && !(defined("DEBUG_UPDATE") &&...
7
by: Fnark | last post by:
Can anyone tell me why this code does not do what I want it to: <?php if (!isset($_COOKIE)) { setcookie("basket", $item_code, time()+60*60*24*30, "coursework", '', 0) ; } else { setcookie(...
2
by: bagsmode | last post by:
Hi, I'm trying to set a session cookie and then redirect, however I get the error: Status: 302 Moved Location: /index.cgi I thought I recall getting an error like this when I first tried...
4
by: socialism001 | last post by:
I'm trying to store a value in a cookie but its not working. Can anyone see what I might be doing wrong. Thanks, Chris ~~~~~~~~~~~~~~~~~~ <script language="javascript">...
3
by: Mark Jones | last post by:
Hi All, I'm currently having difficulty putting the text from a selected link in a ButtonColumn from a DataGrid into a cookie. The idea is that a user selects a group link from this column and...
3
by: Ben | last post by:
I'm having problems with cookies from asp.net to asp back to asp.net. It seems like I can set a cookie in asp.net fine, and alter it at will, as soon as asp touches it, asp.net won't have...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
4
by: SevDer | last post by:
Hi, I've done some coding in my web application however right now for an unknown reason my asp.net 2.0 site is not setting asp.net_sessionid cookie and as a result, I am losing the session data...
2
by: sophie_newbie | last post by:
Hi, I'm using the python to set a cookie when a user logs in. Thing is it doesn't seem to be setting properly in Internet Explorer. It works grand in Firefox. Its basically: c =...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.