16-06-2010, 02:29 PM
I've just implemented a timed pop up on the forum that only guests can see, as soon as they load the page it auto starts counting down, then pops up in a javascript pop up.
What you need to do:
If you're doing this on a webpage, open up your index.html page and put this in the header.
(If you already have the HTML and header tags in on your page, you only need them once.)
Then in the body of your page, you need:
Explanation
Tells the browser that you're going to be using javascript code.
This is the function that you're setting, the "timedMsg" can be anything you want, it's just the name of the function that you're going to recall later.
This is what the function is going to do, it's task.
Then in the body
onLoad means that the Javascript is going to load as soon as you load the webpage, you can then set a timeout; i set mine to 1 millisecond. You also need to recall the function that you set above.
If you want to see how this works, head over to: http://mcompute.co.uk as a guest and wait 30 seconds.
Hope this has helped, if you have any questions please post or PM me.
What you need to do:
If you're doing this on a webpage, open up your index.html page and put this in the header.
(If you already have the HTML and header tags in on your page, you only need them once.)
Code:
<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("alert('Dont just stand there, sign up!')",30000);
}
</script>
</head>
Then in the body of your page, you need:
Code:
<body>
<body onLoad="setTimeout('timedMsg()', 1)">
</body>
</html>
Explanation
Code:
<script type="text/javascript">
Tells the browser that you're going to be using javascript code.
Code:
function timedMsg()
This is the function that you're setting, the "timedMsg" can be anything you want, it's just the name of the function that you're going to recall later.
Code:
{
var t=setTimeout("alert('Dont just stand there, sign up!')",30000);
}
This is what the function is going to do, it's task.
Then in the body
Code:
<body onLoad="setTimeout('timedMsg()', 1)">
onLoad means that the Javascript is going to load as soon as you load the webpage, you can then set a timeout; i set mine to 1 millisecond. You also need to recall the function that you set above.
If you want to see how this works, head over to: http://mcompute.co.uk as a guest and wait 30 seconds.
Hope this has helped, if you have any questions please post or PM me.