Foros del Web » Programando para Internet » Javascript »

Me guerda la cookie, pero despues no la toma en cuenta

Estas en el tema de Me guerda la cookie, pero despues no la toma en cuenta en el foro de Javascript en Foros del Web. la aplicacion en donde sucede esto me surgio desde este post: http://www.forosdelweb.com/showthread.php?t=259098 la aplicacion en donde estoy llevando a cabo esto esta en: http://www.ig2producciones.com.ar/in...rInmuebles.php si ...
  #1 (permalink)  
Antiguo 05/02/2005, 19:07
Avatar de ignacio_giri  
Fecha de Ingreso: febrero-2003
Ubicación: Argentina, Rosario
Mensajes: 585
Antigüedad: 21 años, 2 meses
Puntos: 0
Me guerda la cookie, pero despues no la toma en cuenta

la aplicacion en donde sucede esto me surgio desde este post:

http://www.forosdelweb.com/f13/celdas-desplegables-259098/

la aplicacion en donde estoy llevando a cabo esto esta en:

http://www.ig2producciones.com.ar/in...rInmuebles.php

si te fijaste, el menu lateral y los titulos son desplegables.

eso lo saque del vbulletin de este foro.

les paso el script que hice para que vean porque no me toma la cookie...

las cookies lo que hace aca es guardar si la celda fue mostrada u ocultada entonces personaliza la navegación del usuario de como le quede más comoda.

Código:
 
// define a few variables that are required
var vbmenu_usepopups = false;
var ignorequotechars = 0;
// deja para definir el browser que tenemos en vez de llamadas múltiples a través del archivo
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = (userAgent.indexOf('opera') != -1);
var is_saf	= ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == "Apple Computer, Inc."));
var is_webtv = (userAgent.indexOf('webtv') != -1);
var is_ie	 = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4	= ((is_ie) && (userAgent.indexOf("msie 4.") != -1));
var is_moz	= ((navigator.product == 'Gecko') && (!is_saf));
var is_kon	= (userAgent.indexOf('konqueror') != -1);
var is_ns	 = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4	= ((is_ns) && (parseInt(navigator.appVersion) == 4));
// coja los insectos posibles con WebTV y otros más viejos browsers
var is_regexp = (window.RegExp) ? true : false;
// #############################################################################
// vamos descubrir qué funciones de DOM podemos utilizar
var vbDOMtype = '';
if (document.getElementById)
{
vbDOMtype = "std";
}
else if (document.all)
{
vbDOMtype = "ie4";
}
else if (document.layers)
{
vbDOMtype = "ns4";
}
// haga un arsenal para almacenar localizaciones depositadas de los objetos llamados por el fetch_object
var vBobjects = new Array();
// function para simular document.getElementById
function fetch_object(idname, forcefetch)
{
if (forcefetch || typeof(vBobjects[idname]) == "undefined")
{
switch (vbDOMtype)
{
case "std":
{
	vBobjects[idname] = document.getElementById(idname);
}
break;
case "ie4":
{
	vBobjects[idname] = document.all[idname];
}
break;
case "ns4":
{
	vBobjects[idname] = document.layers[idname];
}
break;
}
}
return vBobjects[idname];
}
// funcione para manejar los diversos modelos del acontecimiento de diversos browsers
// y prevenga burbujear del acontecimiento
function do_an_e(eventobj)
{
if (!eventobj || is_ie)
{
window.event.returnValue = false;
window.event.cancelBubble = true;
return window.event;
}
else
{
eventobj.stopPropagation();
eventobj.preventDefault();
return eventobj;
}
}
function js_toggle_all(formobj, formtype, option, exclude, setto)
{
for (var i =0; i < formobj.elements.length; i++)
{
var elm = formobj.elements[i];
if (elm.type == formtype && in_array(elm.name, exclude, false) == -1)
{
switch (formtype)
{
	case "radio":
	 if (elm.value == option) // option == '' evaluates true when option = 0
	 {
	 elm.checked = setto;
	 }
	break;
	case "select-one":
	 elm.selectedIndex = setto;
	break;
	default:
	 elm.checked = setto;
	break;
}
}
}
}
// function to trim quotes and vbcode tags
function stripcode(str, ishtml, stripquotes)
{
if (!is_regexp)
{
return str;
}
if (stripquotes)
{
var quote1 = new RegExp("(\\[QUOTE\\])(.*)(\\[\\/QUOTE\\])", "gi");
var quote2 = new RegExp("(\\[QUOTE=(&quot;|\"|\\'|)(.*)\\1\\])(.*)(\\[\\/QUOTE\\])", "gi");
while(str.match(quote1))
{
str = str.replace(quote1, '');
}
while(str.match(quote2))
{
str = str.replace(quote2, '');
}
}
if (ishtml)
{
var html1 = new RegExp("<(\\w+)[^>]*>", "gi");
var html2 = new RegExp("<\\/\\w+>", "gi");
str = str.replace(html1, '');
str = str.replace(html2, '');
var html3 = new RegExp("&nbsp;");
str = str.replace(html3, '');
}
else
{
var bbcode1 = new RegExp("\\[(\\w+)[^\\]]*\\]", "gi");
var bbcode2 = new RegExp("\\[\\/(\\w+)\\]", "gi");
str = str.replace(bbcode1, '');
str = str.replace(bbcode2, '');
}
return str;
}
// emulation of the PHP
function construct_phrase()
{
if (!arguments || arguments.length < 1 || !is_regexp)
{
return false;
}
var args = arguments;
var str = args[0];
var re;
for (var i = 1; i < args.length; i++)
{
re = new RegExp("%" + i + "\\$s", "gi");
str = str.replace(re, args[i]);
}
return str;
}
// set control panel frameset title
function set_cp_title()
{
if (typeof(parent.document) != "undefined" && typeof(parent.document) != "unknown" && typeof(parent.document.title) == "string")
{
if (document.title != '')
{
parent.document.title = document.title;
}
else
{
parent.document.title = "vBulletin";
}
}
}
function switch_styleid(selectobj)
{
var styleid = selectobj.options[selectobj.selectedIndex].value;
if (styleid == "")
{
return;
}
var url = new String(window.location);
var fragment = new String("");
// get rid of fragment
url = url.split("#");
// deal with the fragment first
if (url[1])
{
fragment = "#" + url[1];
}
// deal with the main url
url = url[0];
// remove styleid=x& from main bit
if (url.indexOf("styleid=") != -1 && is_regexp)
{
re = new RegExp("styleid=\\d+&?");
url = url.replace(re, "");
}
// add the ? to the url if needed
if (url.indexOf("?") == -1)
{
url += "?";
}
else
{
// make sure that we have a valid character to join our styleid bit
lastchar = url.substr(url.length - 1);
if (lastchar != "&" && lastchar != "?")
{
url += "&";
}
}
window.location = url + "styleid=" + styleid + fragment;
}
// simple function to toggle the 'display' attribute of an object
function toggle_display(idname)
{
obj = fetch_object(idname);
if (obj)
{
if (obj.style.display == "none")
{
obj.style.display = "";
}
else
{
obj.style.display = "none";
}
}
return false;
}
// #############################################################################
// ##################### vBulletin Cookie Functions ############################
// #############################################################################
// #############################################################################
// function to set a cookie
function set_cookie(name, value, expires)
{
if (!expires)
{
expires = new Date();
}
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/";
}
// #############################################################################
// function to retrieve a cookie
function fetch_cookie(name)
{
cookie_name = name + "=";
cookie_length = document.cookie.length;
cookie_begin = 0;
while (cookie_begin < cookie_length)
{
value_begin = cookie_begin + cookie_name.length;
if (document.cookie.substring(cookie_begin, value_begin) == cookie_name)
{
var value_end = document.cookie.indexOf (";", value_begin);
if (value_end == -1)
{
	value_end = cookie_length;
}
return unescape(document.cookie.substring(value_begin, value_end));
}
cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
if (cookie_begin == 0)
{
break;
}
}
return null;
}
// #############################################################################
// function to delete a cookie
function delete_cookie(name)
{
var expireNow = new Date();
document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}
// #############################################################################
// function to toggle the admin state of an object, and save to a cookie
function toggle_admind(objid)
{
if (!is_regexp)
{
return false;
}
 
obj = fetch_object("admindobj_" + objid); 
img = fetch_object("admindimg_" + objid);
cel = fetch_object("admindcel_" + objid);
 
if (!obj)
{
// nothing to admin!
if (img)
{
// hide the clicky image if there is one
img.style.display = "none";
}
return false;
}
if (obj.style.display == "none")
{
obj.style.display = "";
save_admind(objid, false);
if (img)
{
img_re = new RegExp("_admind\\.gif$");
img.src = img.src.replace(img_re, '.gif');
}
if (cel)
{
cel_re = new RegExp("^(thead|tcat)(_admind)$");
cel.className = cel.className.replace(cel_re, '$1');
}
}
else
{
obj.style.display = "none";
save_admind(objid, true);
if (img)
{
img_re = new RegExp("\\.gif$");
img.src = img.src.replace(img_re, '_admind.gif');
}
if (cel)
{
cel_re = new RegExp("^(thead|tcat)$");
cel.className = cel.className.replace(cel_re, '$1_admind');
}
}
return false;
}
// #############################################################################
// update vbulletin_collapse cookie with admin preferences
function save_admind(objid, addadmind)
{
var admind = fetch_cookie("cookie");
var tmp = new Array();
if (admind != null)
{
admind = admind.split("\n");
for (i in admind)
{
if (admind[i] != objid && admind[i] != "")
{
	tmp[tmp.length] = admind[i];
}
}
}
if (addadmind)
{
tmp[tmp.length] = objid;
}
expires = new Date();
expires.setTime(expires.getTime() + (1000 * 86400 * 365));
set_cookie("cookie", tmp.join("\n"), expires);
}
//
__________________
Ignacio
  #2 (permalink)  
Antiguo 06/02/2005, 16:25
Avatar de ignacio_giri  
Fecha de Ingreso: febrero-2003
Ubicación: Argentina, Rosario
Mensajes: 585
Antigüedad: 21 años, 2 meses
Puntos: 0
ayuda, please!!!!
__________________
Ignacio
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:46.