Jump to content


This topic is now archived and is closed to further replies.


hide media box with button click

Recommended Posts

whonu    0

I have a media box with a class name of media_image" which I want to clock when I button is clicked.  I found a script that does it and implemented this script


<script type="text/javascript" language="javascript">// <![CDATA[
function showHide() {
    var ele = document.getElementsByClassName("main_image")[0];
    if(ele.style.display == "block") {
            ele.style.display = "none";
    else {
        ele.style.display = "block";
// ]]></script>
I then created a button to with this code 
<form action="" method="post">
<input onclick="return showHide();" type="button" value="Show-Hide" /></form>

but it is not closing the media box.  Any suggestions would be helpful.


Share this post

Link to post
Share on other sites
Danny    1,327



Not sure what you mean by clock and close. Are you saying that when the button in the mediabox is clicked you want the whole media box to hide or close. If you mean close, how do you want it to close ?

The MediaBox isn't an accordion, or have I completely misunderstood what you're trying to achieve lol ?

Please search our forums, before posting!

Share this post

Link to post
Share on other sites