Collabsable table/div without javascript

Discussion in 'HTML & Website Design' started by boebi, Apr 9, 2008.

  1. #1
    I'm trying to get a collabsable table or div for use in forum signatures.

    <div>
        <CENTER><div class="pre-spoiler">
        <span style="float: left; padding-top: 2px;"></span> <input value="Show F.A.Q." style="margin: 0px; padding: 0px; width: 75px; font-size: 10px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide F.A.Q.'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show F.A.Q.';}" type="button">
        </div>
    
        <div>
            <div class="spoiler" style="display: none;"><br>
    
    test
    </div>
    </div>
    PHP:
    Because it's a forum signature it cannot use javascript.
    This code works in a plain html document, but for some reason it doesn't on the forum.
    The button appears, but when I click it nothing happens. Also the button text doesnt change to 'hide FAQ'. It just gets pressed thats all.

    Any suggestions, or other code snippets I could use?
    Thanks very much
     
    boebi, Apr 9, 2008 IP