Results 1 to 3 of 3

Thread: Change content after x seconds?

  1. #1
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Change content after x seconds?

    Hi,

    I am trying to create a rapidshare clone, but I need to have the show download button after x seconds.

    I already have a countdown added, but I do not know how to show the download button after x seconds.

    What code should I use?

    I suck at Javascript

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It depends upon why the download button can't be seen in the first place. If it is visibility: hidden; via css style and has - say, an id of "dwnbut", you could do:

    Code:
    document.getElementById('dwnbut').style.visibility = 'visible';
    But it really would depend upon your markup, perhaps other existing code, and as I say upon why that button cannot be seen at first.

    If you want more help:

    Please post a link to the page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Hi Peter,

    As John mentioned the real code will be based on your markup. But here is a demo one:

    Code:
    var x = 1000; //Specify the number of millie seconds after you want to show the element.
    setTimeout(function(){
        var d = document.getElementById('dwnbut');
        if(d){
            d.style.visibility = 'visible';
        }
    }, x);
    This code assumes that you have a HTML element with an ID 'dwnbut' in your page. If the page does not contain the element then it will not do anything.

Bookmarks

Posting Permissions

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