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 Link to comment https://forums.phpfreaks.com/topic/55449-displayhide-buttons/ 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> Link to comment https://forums.phpfreaks.com/topic/55449-displayhide-buttons/#findComment-274688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.