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 Link to comment https://forums.phpfreaks.com/topic/112200-image-linked-to-form/ 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" /> Link to comment https://forums.phpfreaks.com/topic/112200-image-linked-to-form/#findComment-576395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.