| Back to top |
Hi,
I've found a bug in the sample code on [new user link]. The Get_cookie() funtion uses global variable "i" as a loop index. Thus, this function overwrites the contents of the "i" global variable, which is an unexpected side effect. Replacing :: Code :: for ( i = 0; i < a_all_cookies.length; i++ ):: Code :: for ( var i = 0; i < a_all_cookies.length; i++ ) |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 2541 Location: East Coast, West Coast? I know it's one of them. |
Calling this a bug is stretching it a bit, more of a wish list item, but I added an explicit var i = ''; declaration anyway since it is always good practice to declare and localize variables, though in this case there was no actual error in the script in terms of its own operation.
|
|||||
| Back to top |
I guess it all depends whether or not you consider this function is meant to be used in larger programs. Call this function in a loop writen in the same style (with a global "i" as loop index) and you end up with a mess.
|
|||||
| Back to top |
My first shot at cookies:
Pls, where is the original code that this Post fixes? Thanks...vmars316 |
|||||
|
techAdmin
Back to top
Status: Site Admin Joined: 26 Sep 2003 Posts: 2541 Location: East Coast, West Coast? I know it's one of them. |
click on the link in the first post.
|
|||||
|
All times are GMT - 8 Hours
|
||||||