View Full Version : Form Link button to appear after 3 minutes after page load
bob27707
April 16th, 2010, 09:45 PM
Hi all,
I am not a expert by any means but I need help coding some javascript. I want this:
<form>
<input type=button value="CONTINUE" onClick="goToURLbcci()">
</form>
to appear on my page after 3 minutes (3 minutes and ten seconds actually).
I have been reading about the use of times and onpageload but to be honestm I'm so lost. Can someone help me?
Thank you in advance
bob27707
April 17th, 2010, 06:22 AM
Oh one more thing... I'd like to center this button on the page. Is there syntax for that as well?
icio
April 17th, 2010, 07:56 AM
Something like this ought to do the trick for you.
<html>
<head>
<script type="text/javascript">
function showButton()
{
document.getElementById("btnContinue").style.visibility = "visible";
}
function hideButton()
{
document.getElementById("btnContinue").style.visibility = "hidden";
}
window.onload = function()
{
hideButton();
setTimeout('showButton()', 5000);
}
</script>
</head>
<body>
<input type="button" id="btnContinue" value="Continue" onclick="goToURLbcci()" />
</body>
</html>
That 5000 you see is the number of milliseconds that you want the script to wait before showing the button. For your usage you'll want to change it to 190000 (190 seconds).
Hope that helps :thumb:
[whisper]
bob27707
April 17th, 2010, 10:52 PM
That worked perfectly. Thanks. Now how can I get the button to the center? Can you help there too?
icio
April 18th, 2010, 06:49 AM
Just work with the button as you normally would. Surround it with it's normal HTML to centre it and place it within whatever elements that you like. Applying CSS to it's parent would be my preferred way of centring it.
The script will still work fine.
bob27707
April 18th, 2010, 07:43 AM
Thank you so much. I really appreciate your help.
icio
April 18th, 2010, 07:58 AM
My pleasure :)
bob27707
April 21st, 2010, 11:22 AM
Ignore the following... i found the answer... There is a wordpress plugin allowing me to insert head meta into the pages i need it on. It works perfectly.
> Hi there, me again.
> The code you gave me for the header... I'm inserting it in the head section of header.php in my wordpress blog. This applies it to all pages on the site but I only use the button on one. I don't see a way to just insert the code in the header of the pages that have the button but the ones that have it, it works great.. the ones that don't... IE shows an error on page. Any ideas?
My pleasure :)
icio
April 21st, 2010, 12:47 PM
var btnContinue;
function showButton()
{
btnContinue.style.visibility = "visible";
}
function hideButton()
{
btnContinue.style.visibility = "hidden";
}
window.onload = function()
{
btnContinue = document.getElementById("btnContinue");
if (btnContinue)
{
hideButton();
setTimeout('showButton()', 5000);
}
}
This will only try to hide and show the button if the button exists on the page. I hope that helps :thumb:
bob27707
July 11th, 2010, 10:07 PM
Hello, me again. Posing a new question to you (or anyone in this forum). I want the same button to appear as before except instead of a delay from pageload, I want the button to appear 45 minutes, 25 seconds past the top of the hour. For instance, if the user arrives at my web page at 19:55 PM I want the button to appear at 20:45:25. Likewise, if the user comes to the page at 20:05 PM , I still want the button to appear at 8:45:25. Make sense?
Now, the timer should reset at the top of every/any hour. The hour is somewhat irrelevant... I guess what I'm saying is that if the user arrives any time before hh:45:25 then display the button within that hour... if they arrive after, then display the button the next hour.
Help please.
My pleasure :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.