Hi,
In my form i have a button which calls a js function to do some action.After the action a message shows.I want to know how can i hide the div if the message has been shown for 10 second.Any help?
Hide div after few seconds
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Hide div after few seconds
Use one of the Javascript timer functions (setTimeout(), clearTimeout(), setInterval() and clearInterval() ). They will call a function after a specified amount of time. Set it for 10 seconds and have the function you pass to it hide the div.
(#10850)
Re: Hide div after few seconds
Hi..
Thanks arborint ....i was working on that but still its not working...my code was
have a div tag like this..
<div id="d" style="display:inline">
<?php echo $this->message;?>
</div>
and the js
function sendStatusReport(){
document.listclientchoosen.action = "<?php echo $this->baseUrl;?>/admin/clientexports/report";
document.listclientchoosen.submit();
setTimeout("toggle()", 8000 );
}
function toggle() {
var ele = document.getElementById("d");
ele.style.display = "none";
}
Wat am i doing wrong....??also the action performing inside the sendstatusreport() is mail sending.So it amy took 8s or 10 s or 15 s.How can excatly point out the time.
Thanks arborint ....i was working on that but still its not working...my code was
have a div tag like this..
<div id="d" style="display:inline">
<?php echo $this->message;?>
</div>
and the js
function sendStatusReport(){
document.listclientchoosen.action = "<?php echo $this->baseUrl;?>/admin/clientexports/report";
document.listclientchoosen.submit();
setTimeout("toggle()", 8000 );
}
function toggle() {
var ele = document.getElementById("d");
ele.style.display = "none";
}
Wat am i doing wrong....??also the action performing inside the sendstatusreport() is mail sending.So it amy took 8s or 10 s or 15 s.How can excatly point out the time.