ramli Posted February 4, 2007 Share Posted February 4, 2007 I want to unhide a div depending on the value of a selectbox option value <script type="text/javascript" language="JavaScript" src="subform.js"></script> <form name='template'> <select name='choise' onchange="javascript:ShowContent('value of option')"> <option value="uniquename">uniquename</option> </select> </form> ----------- This is the way it does work only this is a link. <a onmouseover="ShowContent('uniquename'); return true;" href="javascript:ShowContent('uniquename')"> [show] </a> ---------------- <div id="uniquename" style="display:none; left:200px; top:100px; border-style: solid; background-color: white; padding: 5px;"> Content goes here. </div> code in subform.js: function HideContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "none"; } function ShowContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "block"; } function ReverseContentDisplay(d) { if(d.length < 1) { return; } if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } } as you can see i got some of the work done . However i dont know how to read the value in the onchance handeler. can sombody help me pleace. Link to comment https://forums.phpfreaks.com/topic/37052-solved-hide-and-unhide-a-div-with-a-selectbox/ Share on other sites More sharing options...
fenway Posted February 5, 2007 Share Posted February 5, 2007 I'm not sure what you're trying to do... but the javascript: prefix is not necessary in JS event handlers. Link to comment https://forums.phpfreaks.com/topic/37052-solved-hide-and-unhide-a-div-with-a-selectbox/#findComment-177188 Share on other sites More sharing options...
ramli Posted February 5, 2007 Author Share Posted February 5, 2007 problem solved Link to comment https://forums.phpfreaks.com/topic/37052-solved-hide-and-unhide-a-div-with-a-selectbox/#findComment-177472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.