Click to See Complete Forum and Search --> : timed redirect to another webpage is not working


gg03
04-30-2004, 09:57 PM
Hi,

I'm trying to redirect the user to another webpage AFTER the user has submitted a few data from this form:

http://www.besthealthsearch.com/weightdepot/homemock.php

The form I'm referring to is under the heading "system recommendations".

I tried using this code, but it doesn't seem to work.

<!-- Original: Marat Rikelman (rikelman@bellsouth.net) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function mod(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi() {
var w = document.bmi.weight.value * 1;
var HeightFeetInt = document.bmi.htf.value * 1;
var HeightInchesInt = document.bmi.hti.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round((w * 703) / (h * h)));
var rvalue = true;
if ( (w <= 35) || (w >= 500) || (h <= 48) || (h >= 120) ) {
alert ("Invalid data. Please check and re-enter!");
rvalue = false;
}
if (rvalue) {
if (HeightInchesInt > 11) {
reminderinches = mod(HeightInchesInt,12);
document.bmi.hti.value = reminderinches;
document.bmi.htf.value = HeightFeetInt +
((HeightInchesInt - reminderinches)/12);
document.bmi.answer.value = displaybmi;
}
if (displaybmi <19)
document.bmi.comment.value = "System 1";
redirTime = "15000";
redirURL = "http://www.weightdepot.com/easy-weightloss.html";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
if (displaybmi >=19 && displaybmi <=25)
document.bmi.comment.value = "System 1"
redirTime = "15000";
redirURL = "http://www.weightdepot.com/easy-weightloss.html";
function redirTimer() { self.setTimeout("self.location.href = redirURL;",redirTime); }
if (displaybmi >=26 && displaybmi <=29)
document.bmi.comment.value = "System 2";
window.location = 'http://www.weightdepot.com/easy-weightloss.html';
if (displaybmi >=30 && displaybmi <=40)
document.bmi.comment.value = "System Gold";
window.location = 'http://www.weightdepot.com/easy-weightloss.html';
if (displaybmi >40)
document.bmi.comment.value = "System Gold";
window.location = 'http://www.weightdepot.com/easy-weightloss.html';
document.bmi.answer.value = displaybmi; }
return rvalue;
}
// End -->

The redirect time is set to "15000", but it's redirected instantly once the "select a system" button is clicked.

Currently, when they entered the data and click on the "select a system", they are redirect too quickly. I would like to slow down the redirect to about 3 to 5 seconds.

Please advise.

Thank you so much for your help! :-)

Nedals
04-30-2004, 10:26 PM
http://forums.webdeveloper.com/showthread.php?s=&threadid=33739