![]() |
Cookies and OOP
1 Attachment(s)
The posting of this code was inspired by beetle
Quote:
Code:
|
...and what's wrong with my cookie script? :D
I have posted this more than once, I find it very useful and use it all the time :) Code:
//----- COOKIE OBJECT ------------------------------------------------------------------------------------------------------------------//::] krycek [:: |
Nothing is wrong with yours.
My script has functionality to set the cookie attributes such as path, domain, version. It parses the document.cookie string once at initialization, which can arguably be more efficient when there are many cookies which are accessed often. Other than that.... great minds think alike.... :D :D |
Hey now, what's going on here? I inspire people?
hehe.... Thanks for the code fellas, I just might have a use for one of these :D |
I have this kicking around my hard drive:
Code:
var CookieJar = {But it does have playful names :). |
JKD, I'm not familiar with the syntax you used here:
Code:
Cookie: function(name, value, expires, domain, path, secure)Code:
this.Cookie=function(name, value, expires, domain, path, secure)Also is it possible to pass arguments through an anonymous function within an object like this?: Code:
this.fill(a, b, c)=function(a, b, c) |
Ya Skyzyx, you got it right. What jkd used is called an object literal. The same way this
Code:
var nums = [1,2,3,4];Code:
var nums = new Array(1,2,3,4);Code:
var nums = { M: 1000, D:500, C:100, L:50, X:10, V:5, I:1 }Code:
var nums = new Object();About the parameter passing thing with anon function...that's not really an anonymous function, it's name is fill and you can't pass parameters like that. Hope I've helped |
Perhaps, I could try something like this...
Code:
function fill(a, b, c)Code:
var bob=new myObject; |
|
Here's something I was able to throw together.
Code:
/*************************myCookie=('Name', 'Value', 365, '/', 'Domain.com', 'Secure'); These are the main functions: myCookie.set(); myCookie.read(); myCookie.kill(); ... And you can change values on the fly without re-initializing the cookie. myCookie.changeVal('New Value'); ... etc. Whaddya guys think? |
Where DO I PUT THOSE COOKIES?
I've got a script that was made for me by a guy that told me Adios. I loved the little thing, except there's one problemo...that be...every time the images reload there's a chance of one or two of those images from the previous load popping up in the table of ten images. (BTW)
So : here's the script: Where do I put the cookies, so I don't see these images repeat every other time or whatever? |
| All times are GMT +1. The time now is 09:06 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.