keane89wolves Posted June 27, 2008 Share Posted June 27, 2008 Hi, i am new to javascript, so i am looking for a point in the right direction if possible. What i want is an image to change when the selection in a form list is changed. Both the list and the images are going to becoming from the database. Is this possible? Thanks Keane Quote Link to comment Share on other sites More sharing options...
xtopolis Posted June 28, 2008 Share Posted June 28, 2008 This may be incomplete, but contains functions to get you started/ <script type="text/javascript"> function swapImage(arg) { var x = document.getElementById(arg); var y = x.options[x.selectedIndex].value); var z = document.getElementById("swapper"); z.src = y; } </script> <select name="list1" onchange=swapImage('list1')> <option value=image1.jpg>Picture 1</option> <option value=image2.jpg>Picture 2</option> </select> <img src="image3.jpg" id="swapper" /> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.