Page 1 of 1

Show a message for num of seconds?

Posted: Thu Sep 25, 2008 7:02 pm
by Sindarin
How can I show a message to the user the way Wordpress does it? It doesn't have to fade out or anything funky, I just need it to hide after 10 seconds.

Re: Show a message for num of seconds?

Posted: Fri Sep 26, 2008 1:34 am
by VladSun
I don't know how Wordpress does it, but I think you are looking for setTimeout()

Re: Show a message for num of seconds?

Posted: Fri Sep 26, 2008 6:09 am
by Sindarin

Code: Select all

function showMsg()
{
var t=setTimeout("document.write('test')",2000);
hideMsg();
}
function hideMsg()
{
var t=setTimeout("document.write(' ')",3000);
}
It seems I could do it that way, but still document.write removes any other code, does anyone know how to use document.write but also keep the current document code?

Re: Show a message for num of seconds?

Posted: Fri Sep 26, 2008 6:13 am
by VladSun
You need a DIV which will display/hide the message and write to its contents by using its innerHTML attribute.

Re: Show a message for num of seconds?

Posted: Fri Sep 26, 2008 6:40 am
by Sindarin
what? 8O *so much stuff to start with*