Quote:
Originally Posted by Will Bontrager
This may do it for you:
Code:
<select onchange="document.getElementById('dropimage1').src = this.options[this.selectedIndex].value">
<option value="http://www.willmaster.com/images/wmlogo_icon.gif">Willmaster Logo</option>
<option value="http://www.willmaster.com/08images/wslogo150x156.jpg">WebSite's Secret logo</option>
<option value="http://www.willmaster.com/software/productimages/shortURLv2.jpg">Short URL software logo</option>
<option value="http://www.willmaster.com/software/db-backup-restore/images/DB-backup-restore.jpg">Database Back Up and Restore logo</option>
</select>
<p>
<img id="dropimage1" src="http://www.willmaster.com/images/wmlogo_icon.gif" alt="place for image">
</p>
<select onchange="document.getElementById('dropimage2').src = this.options[this.selectedIndex].value">
<option value="http://www.willmaster.com/images/wmlogo_icon.gif">Willmaster Logo</option>
<option value="http://www.willmaster.com/08images/wslogo150x156.jpg">WebSite's Secret logo</option>
<option value="http://www.willmaster.com/software/productimages/shortURLv2.jpg">Short URL software logo</option>
<option value="http://www.willmaster.com/software/db-backup-restore/images/DB-backup-restore.jpg">Database Back Up and Restore logo</option>
</select>
<p>
<img id="dropimage2" src="http://www.willmaster.com/images/wmlogo_icon.gif" alt="place for image">
</p>
Note the id values in this color.
Each select field's onchange attribute specifies the id value of the corresponding image tag. This method will allow you to insert as many dropdown/image sets as you please. Just ensure each image tag has a unique id value.
The example images are my own so the code can be copied and tested without first finding images to test with.
Will
|
Hi Will,
Many thanks for your help with this. Your code works great and is very simple to implement, again thank you for sharing.
Whilst this improves upon what I had and provides a great solution, its not quite what I was looking for. If possible what I would like to do is include two drop downs where one filters the options to another and upon selection of both drop downs displays an image underneath.
For example the first drop down could include five options, options 1-5 and drop down two would include filtered options based upon the selection of drop down one. So from drop down menu one the user could select 'option 1' and drop down menu two could include an array of options, lets say options A-C (where options A-C are the images that will render below the drop downs. If the user selected 'Option 2' from the first drop down they could be presented with options D-F within drop down two and so on. Hope that makes sense!
If you are able to help further with this that would be great, if not thank you very much for your suggestion. I don't have a great knowledge on this subject so any additional information will be greatly received.