Answer the question
In order to leave comments, you need to log in
Countdown timer and text after it?
Dear Toasters, Hello!
There was a very important problem for me.
Since I'm not very versed in JavaScript in principle, I'll forgive the help here: for a friend, I had an idea to make a small and simple (!) Postcard website for his birthday.
The bottom line is this: he enters the site, and there is a countdown timer to his d / r (suppose, until November 1).
After he visited the site on November 1, the timer disappeared and the following appeared: when the page loaded, the text was being printed.
like here (you have to wait 20 seconds www.psy.msu.ru/404.html)
So what I did:
I took the js code from this site, wrote a simple html site and pasted the code from that page into it. the printed text appeared, but now another question arose - how to fasten the timer, but only AFTER the time has elapsed, show the printed text?
Thanks in advance!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Это твой праздник..</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8"
name=Keywords>
<meta content="MSHTML 6.00.2600.0" name=GENERATOR>
<script language=javascript>
//some script
document.onmousedown=click;
function click(e){
if (event.button == 2){
alert('Здесь тоже ничего нет!');
}
}
//finish
<!--
var tl = new Array(
"Вы смотрите на эту страницу уже 20 секунд.",
"Странно, что Вы ещё тут."
);
var speed = 40;
var index = 0; text_pos = 0;
var str_length = tl[0].length;
var contents, row;
function err_text()
{
window.setTimeout( "type_text()", 2000);
}
function type_text()
{
contents = '';
row = Math.max(0, index-7);
while (row<index) contents += tl[row++] + '\r\n';
document.forms[0].elements[0].value = contents + tl[index].substring(0,text_pos) + "_";
if (text_pos ++== str_length)
{
text_pos = 0;
index++;
if (index != tl.length)
{
str_length = tl[index].length;
setTimeout("type_text()", 1500);
}
} else
setTimeout("type_text()", speed);
}
//-->
</script>
</head>
<body text=#000000 vLink=#00007f aLink=#ff0000 link=#0000ff bgColor=#ffffff
onload=err_text()>
<script src="http://megatimer.ru/s/060ac825cfb366815634d5dd276a8938.js"></script> //это таймер с сайта, но если его оставить, то текст так и будет идти вместе с таймером..
<hr>
<br>
<br>
<form>
<textarea rows=8 cols=60 style="border:none;overflow: hidden;"></textarea>
</form>
<br>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question