aeris130 Posted April 29, 2006 Share Posted April 29, 2006 I have the following script written in my head-section:[code]<script>function showhide(id){if (document.getElementById){obj = document.getElementById(id);if (obj.style.display == "none"){obj.style.display = "";} else {obj.style.display = "none";}}}</script> [/code]Then I use the following link to show/hide divs (and their content):[code]<a href="#" onclick="showhide('div_venice'); return(false);">Venice</a>[/code]The problem is, I want to put these links on a select-list, and assign different values (for a php query) when I select them.[code]<select name="a_serie"> <option value ="none"> </a></option> <option value ="ven">Venice</a></option> <option value ="yor">York</a></option> </select>[/code]When i select one of the two cities, I also want the javascript-link to show/hide its div. Are there any solutions for this? Quote Link to comment https://forums.phpfreaks.com/topic/8701-select-field-javascript/ Share on other sites More sharing options...
GBS Posted April 29, 2006 Share Posted April 29, 2006 Hi there,,I guess you should use the 'onselect' property with select objects,,try something like:----<option value ="ven" onselect=showhide('div_venice')>Venice</option>----& the value "ven" could be used in the php part,hmm,,... & I don't think you need to use the '<a href="#" ...>' in what you need,... some onmouseover/onmouseout could do the thing,Hoping it helps,,l8tr, Quote Link to comment https://forums.phpfreaks.com/topic/8701-select-field-javascript/#findComment-31962 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.