adding javascript settimeout function

I am not a coder/programmer and I found a script I would like to use and I used my wysiwyg editor to try to make it work the best I could, but it still does not work the way I want maybe someone could help me.

The script:

<script type="text/javascript">
<!--
redirectTime = "5000";
redirectURL = "http://somesite.com";
function timedRedirect() {

setTimeout("location.href = redirectURL;",redirectTime);

}
//   -->
</script>

<textarea name="TextArea1" id="TextArea1" onblur="timedRedirect() ;return false;"    style="position:absolute;left:200px;top:390px;width:108px;height:108px;z-index:1;" rows="3" cols="9"></textarea>

With this this script I am trying to add an alert box to it, the script works (found it online), but when I try to add the alert to it triggers automatically not after the timer goes off. It should trigger the same time as the script. It show go alert box, url redirect at specified settimeout.

If someone could help that would be great. I tried to scripted them to work to the best of my ability and was not able to If someone could put an edited version of what I am trying to accomplish that would be great.

Answers


var redirectTime = 5000;
var redirectURL = "http://somesite.com";

function doRedirect() {
    alert("We're about to redirect!");
    window.location.href = redirectURL;
}

function timedRedirect() {
    setTimeout(doRedirect, redirectTime);
}

Need Your Help

Why code is throwing IllegalArgumentException for the following code?

android

I am trying to get a csv file from url. But I am getting error as

C++ Factory Pattern with Heterogenous Constructor Constraint

c++ templates boost dispatcher factory-pattern

I'm implementing a C++ program that can programmatically instantiate objects given an input file which provides the class names and arguments to pass to the constructors.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.