mikejs Posted January 15, 2010 Share Posted January 15, 2010 Hi is it possible to use java to close a div on this button click <a class="button" id="submitbutton" href="#"><span id="buttontext">Search</span> </a> I did try using onclick="changeme('notice', 'hide');" notice being the name of the div with <script> function changeme(notice, action) { if (action=="hide") { document.getElementById(notice).style.display = "none"; } else { document.getElementById(notice).style.display = "block"; } } </script> in my header but it didn't work any suggestions :-) Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 It sure is.. but its not done with PHP.. Wrong forum.. <a href="javascript:checkit('id')">Toggle View</a> <div id="id">Some pretty stuff in here</div> thats your html <script type="text/javascript"> function checkit(var) { document.getElementById(var).style.display = (document.getElementById(var).style.display == 'none' ? 'block' : 'none'); } </script> 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.