English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I've been working for weeks on this project, and I've pretty much exhausted my internet research, and I cannot figure out how to make a listbox selection change an image on my page. I have the code that appears that it SHOULD work, but when I test it, nothing happens! This is the code I've written so far, can anyone help me figure out what exactly I'm doing wrong?

(will edit the code in)

2007-03-11 16:55:49 · 3 answers · asked by Kevin 3 in Computers & Internet Programming & Design



Car Lot










2007-03-11 16:56:06 · update #1

Hmm, yeah, I tried that too. It's not set into a form though, so document.[object] should cover it in hierarchy, I would think. I did try putting it INTO a form though, too. No luck. :(

2007-03-11 17:05:20 · update #2

3 answers

the way you are writing the code it will only work in IE.

you can't get to an image or anything else directly from document!

you can get there in every browser with document.getElementById('anyid')
after you code the img with

so the src will update!

I suggest you debug your javascript with a browser that shows reasonable errors, like firefox!

If you want better errors, you need firefox, if you need more, there's a plug in called firebug that can assist you even more!

2007-03-11 17:26:04 · answer #1 · answered by jake cigar™ is retired 7 · 1 0

The built-in object reference 'this' (no quotes) is available within event handlers. If you actually need a reference to the form object (and the select element is inside of a form, of course) you could use this.form, but it looks like passing this.selectedIndex from the event handler [anonymous code] to your fucntion would do nicely.