Forum Moderators: open

Message Too Old, No Replies

looping through a cookie

         

eatspinach

3:06 pm on Jul 3, 2009 (gmt 0)

10+ Year Member



hi i have a cookie that is like this,

826, 825, 826, 827, 825, 826, 827, 826, 825, 826, 825, 826, 827, 825, 825, 827, 825, 826, 825, 825, 825, 831, 831, 831, 831, 831, 833, 831

these are all the form id's i need to hide on the page, i need some JavaScript code that loops through each of these and disables them..

so far i have this

function hideMe(str)
{
element = document.getElementById(str);
element.disabled = true;
}

any suggestions?

thanks for your help in advance
dave

whoisgregg

5:09 pm on Jul 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can convert that string to an array, by using the .split() function. Then, just loop through the array, calling your hideMe() function with each array value.

If you have trouble implementing this, simply post back with the code you've tried and we'll do our best to help. :)