Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ Displaying image from drop down

Posted by: thejrod03 Nov 6 2006, 01:57 AM

I have been trying to work this through for hours and cant seem to get it. What I am trying to do is in a form use a drop down menu to display an image but also when the option is selected to retain the value to be processed into a database. heres the basis of what I have...

<script language="javascript">
<!--

/*Combo Box Image Selector:
By JavaScript Kit (www.javascriptkit.com)
Over 200+ free JavaScript here!
*/

function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.origin_state.options[document.mygallery.origin_state.selectedIndex].value
}
//-->
</script>
<form name="mygallery">
<Form action="http://www.onedispatch.com/test/loadposting.php" Method=Post>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<th width="50%"align="center" valign="middle">

<P>Please Select Origin State:<br>
<select name="origin_state" onChange="showimage()">
<option value="AL">AL</option>
<option value="http://www.onedispatch.com/test/michiganarea.JPG">AK</option>
<option value="AZ">AZ</option>
<option value="AR">AR</option>
<option value="CA">CA</option>
<option value="CO">CO</option>
<option value="CT">CT</option>
</select>
<img src="me.gif" name="pictures" width="99" height="100">
<p>Please enter origin area:<br>
<input type=text name="origin_area" size=25" id=origin_area>



</td>

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)