Revision: 26518
Updated Code
at April 29, 2010 18:29 by certainlyakey
Updated Code
/*
HTML: <body onLoad="countDownTimer();">
Ðа Ñтранице должен иметьÑÑ ÐºÐ¾Ð½Ñ‚ÐµÐ¹Ð½ÐµÑ€ Ñ id="js_redirect" и META-тег Ð´Ð»Ñ Ñ€ÐµÐ´Ð¸Ñ€ÐµÐºÑ‚Ð° по иÑтечении времени ожиданиÑ, например:
<META http-equiv="refresh" content="10; URL=page.php">
*/
// countdown timer
function countDownTimer() {
startCountDown(10, 1000);
}
function startCountDown(i, p, f) {
// store parameters
var pause = p;
var fn = f;
var secprefix = "Возврат к оглавлению раздела через <span id='countdown'>";
var secsuffix1 = "</span> Ñекунд";
var secsuffix2 = ""; //окончание
var secsuffix3 = " или <a href='admin_students_rus.php'>прÑмо ÑейчаÑ</a>"
var countDownObj = document.getElementById("js_redirect");
countDownObj.count = function(i) {
// write out count
countDownObj.innerHTML = secprefix + i + secsuffix1 + secsuffix2 + secsuffix3;
if (i == 5) {secsuffix2 = 'Ñ‹'}
if (i == 4) {secsuffix2 = 'Ñ‹'}
if (i == 3) {secsuffix2 = 'Ñ‹'}
if (i == 2) {secsuffix2 = 'у'}
if (i == 1) {secsuffix2 = ''}
else if (i == 0) {
// execute function
fn();
// stop
return;
}
setTimeout(function() {
// repeat
countDownObj.count(i - 1);
},
pause);
}
// set it going
countDownObj.count(i);
}
Revision: 26517
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 29, 2010 18:26 by certainlyakey
Initial Code
// countdown timer
function countDownTimer() {
startCountDown(10, 1000);
}
function startCountDown(i, p, f) {
// store parameters
var pause = p;
var fn = f;
var secprefix = "Возврат к оглавлению раздела через <span id='countdown'>";
var secsuffix1 = "</span> Ñекунд";
var secsuffix2 = ""; //окончание
var secsuffix3 = " или <a href='admin_students_rus.php'>прÑмо ÑейчаÑ</a>"
var countDownObj = document.getElementById("js_redirect");
countDownObj.count = function(i) {
// write out count
countDownObj.innerHTML = secprefix + i + secsuffix1 + secsuffix2 + secsuffix3;
if (i == 5) {secsuffix2 = 'Ñ‹'}
if (i == 4) {secsuffix2 = 'Ñ‹'}
if (i == 3) {secsuffix2 = 'Ñ‹'}
if (i == 2) {secsuffix2 = 'у'}
if (i == 1) {secsuffix2 = ''}
else if (i == 0) {
// execute function
fn();
// stop
return;
}
setTimeout(function() {
// repeat
countDownObj.count(i - 1);
},
pause);
}
// set it going
countDownObj.count(i);
}
Initial URL
http://forums.digitalpoint.com/showthread.php?t=1607369
Initial Description
Initial Title
JS/meta редирект Ñо ÑклонÑющимиÑÑ Ñловами (5 Ñекунд, 2 Ñекунды, 1 Ñекунда...)
Initial Tags
javascript, redirect
Initial Language
JavaScript