I want the button to display exactly 2 minutes after the page loads. Is this possible?
问问题
1970 次
4 回答
1
Exactly is impossible, but close to is like this
<button id="MyButton" style="display:none">Hello</button>
<script type="text/javascript">
setTimeout(function() {
document.getElementById("MyButton").style.visibility='visible';
}, 120000);
</script>
于 2012-10-04T05:44:26.073 回答
1
<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()', 12000);
}
</script>
</head>
<body>
<input type="button" id="btnContinue" value="Continue" />
</body>
</html>
于 2012-10-04T09:16:54.233 回答
0
you can take jquery functions delay
and fadeIn
help for e.g
<button id="MyButton" style="display:none">Hello</button>
$().ready(function(){
$('#MyButton').delay(500).fadeIn(400);
});
delay
will take an integer indicating the number of milliseconds to delay.
i can say its a workaround as it does what you asked for..
于 2012-10-04T05:54:07.070 回答
0
Use jQuery like this
<button id="btnButton" style="display:none">Your Button</button>
<script type="text/javascript">
$(document).ready(function(){
setTimeout(function() {
$("#btnButton").show();
}, 120000);
});
</script>
于 2012-10-04T06:21:26.477 回答