how do you repeat a process multiple times with java script
<p>I have found the following code and I was wondering how can I repeat this code 9 times before changing the <code>newPage</code>. What i am doing right now is making 10 html documents and i change <code>newPage</code> to page2.html, page3.html ,page4.html so after the count done it changes and eventually cycles through all these html documents. I want to keep it to only 2 documents. index.html with this code and end.html. index ill perform this code 9 times then change to end.html. Can anyone help?</p>

<pre><code>var startTime = 45;
var newPage = "page2.html";

function countDown() {
    startTime--;
    document.getElementById("counter_display").innerHTML = startTime;

    if (startTime == 0) {
        window.location = newPage;
    }
}

function gett(id) {
    if (document.getElementById) {
        return document.getElementById(id);
    }
    if (document.all) {
        return document.all.id;
    }
    if (document.layers) {
        return document.layers.id;
    }
    if (window.opera) {
        return window.opera.id;
    }
}

function watchNow() {
    if (gett('counter_display')) {
        setInterval(countDown, 1000);
        gett("counter_display").innerHTML = startTime;
    } else {
        setTimeout(watchNow, 50);
    }
}

document.onload = watchNow();

&lt;p&gt;&lt;b id="counter_display"&gt;&lt;/b&gt;&lt;/p&gt;
&lt;iframe frameborder="no" height="735" src="http://website.com/video.php" width="385"&gt;&lt;/iframe&gt;
</code></pre>
