Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default {AJAX} - Open div close div

    Basically like the spolier:

    for my comments thing...and full news..
    http://swindonsound.com/ss/shownews/

  2. #2
    Join Date
    Apr 2006
    Location
    Salford
    Posts
    2,108
    Tokens
    0

    Latest Awards:

    Default

    Lmao:rolleyes:


    PHP Code:
    <script language='JavaScript' type='text/javascript'>
            <!--
                function 
    spoiler(obj)
                {
                      for (var 
    0obj.childNodes.lengthi++)
                      {
                            if (
    obj.childNodes[i].id == 'idTitle')
                                
    titleRow obj.childNodes[i];
                        if (
    obj.childNodes[i].id == 'idSpoiler')
                        {
                            if (
    obj.childNodes[i].style.display != 'none')
                            {
                                
    obj.childNodes[i].style.display 'none';
                                
    titleRow.innerHTML '&nbsp;<b>Click to show spoiler</b>';
                            }
                            else
                            {
                                
    obj.childNodes[i].style.display 'block';
                                
    titleRow.innerHTML '&nbsp;<b>Click to hide spoiler</b>';
                            }
                        }
                    }
                }
            
    //--></script> 
    PHP Code:
    <div width="100%" class="alt1" onclick="spoiler(this);" style="border-collapse: collapse; border: solid thin black;"><div id="idTitle" class="alt2" style="border-collapse: collapse; border: solid thin black; width: 100%;">&nbsp;<b>Click to show spoiler</b></div><div id="idSpoiler" style="display: none;">example</div></div><br /> 
    :eusa_whis

  3. #3
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    1,544

    Latest Awards:

    Default

    Javascript file;

    Code:
    function simpletogglediv(whichLayer)
    {
    	 var theElementStyle = document.getElementById(whichLayer); 
    
    	if(theElementStyle.style.display == "block")
    	{ 
    		theElementStyle.style.display = "none";  
    		 
    	}
    	else
    	{ 
    		theElementStyle.style.display = "block"; 
    	}
    }
    Javascript Include;

    Code:
    <script type="text/javascript" src="filename.js"></script>
    CSS Style Code;

    Code:
    	#one, #two, #three {
    	display: none;
    	}
    And more id's if you have more opening/closing divs on a page.

    The link to open/close the div;

    Code:
    <a href="javascript:simpletogglediv('one');" title="link title"> Link name</a>
    <a href="javascript:simpletogglediv('two');" title="link title"> Link name</a> 
     <a href="javascript:simpletogglediv('three');" title="link title"> Link name</a>
    The divs;

    Code:
    <div id="one">
    Content to open/close here.
    </div>
    
    <div id="two">
    More Content to open/close here.
    </div>
    
    <div id="three">
    Even more Content to open/close here.
    </div>

  4. #4
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default

    nice finding of the page source there kane, thanks tom ill try that later.

  5. #5
    Join Date
    Apr 2006
    Location
    Salford
    Posts
    2,108
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Eccentric View Post
    nice finding of the page source there kane, thanks tom ill try that later.
    Lol Source wth i wrote that.:eusa_whis

  6. #6
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    1,544

    Latest Awards:

    Default

    Quote Originally Posted by Eccentric View Post
    nice finding of the page source there kane
    Lol.

    Tell me if you have any problems with it.

  7. #7
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default

    Quote Originally Posted by redtom View Post


    Lol.

    Tell me if you have any problems with it.
    Thanks I will Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •