View Full Version : Change content after x seconds?
PeterA
10-11-2009, 05:17 PM
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 :o
jscheuer1
10-12-2009, 11:38 AM
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:
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.
codeexploiter
10-12-2009, 11:54 AM
Hi Peter,
As John mentioned the real code will be based on your markup. But here is a demo one:
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.