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. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
ramli Posted February 5, 2007 Author Share Posted February 5, 2007 problem solved 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.