[jQuery] Re: Some If/Then help

2008-07-11 Thread noon
Don't understand when this could occur to make any sense for images being inserted like this without an example, but at any rate... You'll have to think about when and how this is triggered in order for these if statements to be executed because as said, i don't understand switch

[jQuery] Re: Some If/Then help

2008-07-11 Thread brendan
On Jul 11, 9:51 am, noon [EMAIL PROTECTED] wrote: Don't understand when this could occur to make any sense for images being inserted like this without an example, but at any rate.. noon, thanks for your help, I'll give it a try. I should have been a little more specific sorry. It's for

[jQuery] Re: Some If/Then help

2008-07-11 Thread Richard W
Perhaps sommin like this: (untested) var clients = [ 'nike' : 'swoosh.jpg', 'addidas' : '3stripes.jpg', 'reebok' : 'rbk.jpg', 'default' : 'default.jpg' ]; var class = $(#main).attr(class); typeof clients[class] != undefined ? insertImg(clients[class]) : insertImage(clients['default']);

[jQuery] Re: Some If/Then help

2008-07-11 Thread brendan
Thanks Richard, I couldn't get yours to work (my js knowledge is pathetically rusty) and ran out of time to tinker with it, I ended up just prepending the image to the div by class after it's randomly added: $(document).ready(function(){ $(#main.nike).prepend('img src=swoosh.jpg alt=nike /');

[jQuery] Re: Some If/Then help

2008-07-11 Thread Ryura
Richard's didn't work because he formed an array instead of an object like he was planning. Replacing the [ ... ] with { ... } should've made it work. On Jul 11, 4:13 pm, brendan [EMAIL PROTECTED] wrote: Thanks Richard, I couldn't get yours to work (my js knowledge is pathetically rusty) and

[jQuery] Re: Some If/Then help

2008-07-11 Thread Richard W
Indeed it doesn't work, i would have liked JS to accept that syntax, but alas... Ryura, you are correct, if I had been creating an object instead of an array it would have worked. I randomly posted my code with the understanding that everything in JS is treated as an object (including arrays)