Dropdown menu onChange event help

wxdqz

New Member
Hellooo coders,

I've had great experience here before getting questions answered, and I know this is an easy one, so fire away please...

I'm building a form which allows the user to choose from various options, and when an option is chosen a picture is displayed on the drawing board.

I was doing it with an onChange event on radio buttons, but the client would rather see a dropdown menu for the choices. I can't seem to get the onChange event to work for the menu.

Here's the code I've been working with for the radio buttons:


var sf = new Image();
var gr = new Image();
var hd = new Image();
sf.src = "sf.gif";
gr.src = "gr.gif";
hd.src = "hd.gif";
function doStyle(styleimage) {
eval("document['style'].src = " + styleimage + ".src");
}


<form>
<input type="Radio" name="style" value=http://www.webdeveloper.com/forum/archive/index.php/"sf" onclick="doStyle('sf')"> San Francisco<br>
<input type="Radio" name="style" value=http://www.webdeveloper.com/forum/archive/index.php/"gr" onclick="doStyle('gr')"> Grand Rapids<br>
<input type="Radio" name="style" value=http://www.webdeveloper.com/forum/archive/index.php/"hd" onclick="doStyle('hd')"> Half Dollar
</form>

<img name="style" src=http://www.webdeveloper.com/forum/archive/index.php/"blank.gif">

That works great, but how do I switch this radio button set of options to a <select> menu? I thought to use onChange, but that does nothing.

Any help is greatly appreciated,
Carter
 
Back
Top