Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile showing div w/ delay

    Hi there. I'm trying to get a DIV object to show like 2 seconds after the page loads. I tried something like this but it's not working:

    Code:
    <script>
    	function showDiv(id){
    		var obj = document.getElementById(id);
    		obj.style.display = 'block';
    	}
    </script>
    
    </head>
    
    <body onLoad="setTimeout('showDiv(content)', 3000);">
    
    <div id=content style="display: none;">
    MY CONTENT
    </div>

  • #2
    New to the CF scene
    Join Date
    May 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the code below works. be careful with how you use quotes

    Code:
    <script>
    	function showDiv(){
    		var obj = document.getElementById('content');
    		obj.style.display = 'block';
    	}
    </script>
    
    </head>
    
    <body onLoad="setTimeout('showDiv()', 1000);">
    
    <div id='content' style="display: none;">
    MY CONTENT
    </div>

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THanks worked.


  •  

    Posting Permissions

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