Andrew R Posted June 13, 2007 Share Posted June 13, 2007 Hi. I’m using the following script to display/hide parts of the html on the page. I use the span to make this work <script type="text/javascript"> function showStuff(id) { document.getElementById(id).style.display = 'block'; } function hideStuff(id) { document.getElementById(id).style.display = 'none'; } </script> <span id="deals" style="display: display;"> <<<<Html in here>>> </span To make it hide you click on the below link image. <a href="#" onclick="hideStuff('deals'); return false;"><img src="images/hide.png" width="10" height="10" border="0"></a> To make it display you click the below link image. <a href="#" onclick="showStuff('deals'); return false;"><img src="images/show.png" width="10" height="10" border="0"></a> When I click on the above button to hide or display the html how would I get the button to change from hide to show or vice versa? Any help and advice would be much appreciated Thanks Quote Link to comment Share on other sites More sharing options...
nogray Posted June 14, 2007 Share Posted June 14, 2007 Just hide and show the buttons as well <a href="#" onclick="hideStuff('deals'); hideStuff('hide_link); showStuff('show_link'); return false;" id="hide_link"><img src="images/hide.png" width="10" height="10" border="0"></a> <a href="#" onclick="showStuff('deals'); hideStuff('show_link); showStuff('hide_link'); return false;" id="show_link"><img src="images/show.png" width="10" height="10" border="0"></a> 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.