Javascript problem with a function value returning:basic

I  am new to Javascript, could anyone please help me on this.
This is very important for the project I am doing.

I have to submit a form after a certain time.
I use cookies to avoid time going back to initial stages,in case user refreshes the page.

If the user refreshes,
I am able to retrieve the time value from the cookie also, but I am not able to make the countdown run again..

I would really appreciate any help on this.

Below is the code, and its an ASP page.

<meta name="GENERATOR" Content="Microsoft Visual Studio.NET 7.0">

<script language=javascript>
function setCookiez(name, value)
     document.cookie = name + "=" +escape(value);

          var interval = "";
          var iter = 150;
          function startInterval()

               interval = window.setInterval("tTimer()",1000);

          function stopInterval()
              window.clearInterval (interval);
          function tTimer()
                   document.f.display.value = iter--;

                   if(iter % 10==0)

                    alert("You have 50 seconds left");

                  if (iter == -1)
                  alert ("Your Test Ends");

function readCookie()


    var the_cookie = document.cookie;

    var name = unescape(the_cookie);

    var broken_cookie = the_cookie.split("=");
//i split the cookie, here to get the time left
    var name = broken_cookie[2];
          alert("Value of iter is: "+iter);


<body onload="readCookie()" >

     Here we go!!
                         <form name="f" ID="Form2">
                              <input type="text" name="display" value="" ID="Text2">
                         <script language="javascript">

     <script language=javascript>
          document.writeln("here are cookies: "+document.cookie + "<br>");

<script language=javascript>
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<body onload="readCookie();startInterval();" >

should reset your interval with every page load...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.