Javascript fun

Mar 31, 2008 22:25

It turns out that javascript does have the equivalent of a foreach loop:

for each (t in set) {
take action
}

The catch... it works in Firefox 2, but not Opera 9, Safari 3.1, or IE 7. Well, so much for that idea.

Leave a comment

Comments 2

(The comment has been removed)

zeronobus April 1 2008, 18:33:47 UTC
Me too.
I'm working on writing up a dynamic resume (so as radio button can select whether to see cs experience, music experience, or both), and the code will work in Firefox, Safari, and IE... but not Opera. I really don't think I can make myself care with these kinds of incompatibilities; I'll probably just disable that functionality if a browser identifies it as Opera, and if the end user is lying about the browser they're using then it's their own damn fault.

Reply

(The comment has been removed)

zeronobus April 1 2008, 22:57:58 UTC
Well, foreach only works in Firefox, but I can live without it for the simple things I'm doing at the moment; my comment is about a separate issue which only doesn't work in Opera (out of my sample of 4 test browsers).

Did you just suggest php as a coding option? :P

Reply


Leave a comment

Up