[ale] JavaScript question
John Temple
cjtemple at gmail.com
Fri Apr 26 12:11:14 EDT 2013
indexOf returns only the first occurrence so you would need to iterate
through the entire array and save the found keys
var values = Array("a","b","c","a","d","e","b","a","f");
var foundKeys = [];
for (i = 0; i< values.length; i++) {
if(values[i]=="a") {
foundKeys.push(i);
}
}
alert("Found Keys: "+foundKeys.toString());
On Fri, Apr 26, 2013 at 11:11 AM, Geoffrey Myers <
lists at serioustechnology.com> wrote:
> On Apr 26, 2013, at 10:16 AM, James Sumners <james.sumners at gmail.com>
> wrote:
>
> > On Fri, Apr 26, 2013 at 9:59 AM, Geoffrey Myers
> > <lists at serioustechnology.com> wrote:
> >> On Apr 26, 2013, at 9:51 AM, James Sumners <james.sumners at gmail.com>
> wrote:
> >>
> >>> A lot of information that would help us help you....
> >>>
> >>> Are the cookies well formed? Are you sure none of them are terminating
> >>> the cookie parser early (i.e. have a colon in the value when they
> >>> shouldn't)?
> >>
> >> I'm literally displaying what is being compared before the comparison,
> so I would expect that I would see an extraneous colon. Also, by the time I
> get to the for loops, I've stuck the cookies in an array as well, so I'm
> comparing arrays.
> >
> > That's my bad. I was thinking about reading cookies from the header --
> >
> http://stackoverflow.com/questions/2740746/read-an-invalid-cookie-with-java-jsp
> >
> > A little bit of code showing how you are getting the respective values
> > to compare would be helpful.
>
> Yeah, sending from my phone and can't post from work, so I can't do so.
> I'll see if I can later this evening.
>
> >
> >>>
> >>> You might try my cookie object and see if it works for you --
> >>> http://jrfom.com/2010/12/10/javascript-cookie-manager-object/
> >>
> >> Thanks, I'll take a look at it.
> >
> >
> > --
> > James Sumners
> > http://james.roomfullofmirrors.com/
> >
> > "All governments suffer a recurring problem: Power attracts
> > pathological personalities. It is not that power corrupts but that it
> > is magnetic to the corruptible. Such people have a tendency to become
> > drunk on violence, a condition to which they are quickly addicted."
> >
> > Missionaria Protectiva, Text QIV (decto)
> > CH:D 59
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://mail.ale.org/mailman/listinfo/ale
> > See JOBS, ANNOUNCE and SCHOOLS lists at
> > http://mail.ale.org/mailman/listinfo
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
--
John Temple
cjtemple at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130426/eae0397b/attachment-0001.html>
More information about the Ale
mailing list