Im creating a custom bbcode for phpbb, in which i need a "select all" and a "expand/collapse" function. The expand/collapse option should then have a specific style when scrolling is active.

The select and expand/collapse work fine, but where i have a problem is when looking for if scrolling is active.

First the scrolling and looking for it works fine, but the bbcode is not unique (only works on the first one posted) Second the getElementByTagName('testlink') for the expand/collapse link does not work.

So quickly excplayn what i want the script to do, and what is working so far.

  • When div class is ready run function - working
  • set var for the link class (testlink) - not working
  • set var for the content div class - working
  • set var for scrolling - working
  • try to scroll content - working
  • if scrolling works scroll back up - working
  • if scrolling works set visibility of (testlink) to visible - not working
  • if no scrolling (else) set visibility of (testlink) to hidden - not working

    function () {
    var expandlink = this.getElementsByTagName('testlink')[0];  
    var eee = this.getElementsByTagName('dd')[0];   
    var old = eee.scrollTop;
    eee.scrollTop += 220;

    if (eee.scrollTop > old) {
        eee.scrollTop -= 220; = "visible";
    else { = "hidden";
<div class="pre">
    <dt class="pre_header">
        <b>Code: </b>
        <a class="testlink" href="#">expand</a>
    <dd style="overflow:auto;">
        content here
Hope to get some help, and when it all done ill add the whole BBcode for others to use..