I need to build a page that auto-refreshes on a default setting (5 seconds in my example) or allows the user to change the page reload time.

I'm not quite sure how to do this, my line of thinking now is to set a cookie based on the value the user enters in the text field, then retrieve that value to set the form value when the page loads. I'm not sure if this is the best way, just what I'm thinking...

The value the user enters needs to persist when the page reloads as well. For example, the page defaults to reloading every 5 seconds, but if the user changes it to 15, when the page reloads, 15 needs to be reflected in the text field, not the default 5. Plus, the setInterval value needs to be that same value.

I've never done any cookie work before, is this the right way to go and can someone kind of steer me code-wise?

Also, this is a one-off project for IE 6 only as well.

This is what I'm starting with:

<script type="text/javascript">
//default time in milliseconds
var howlong = 5000; 

//user-config reload
function setDelay() {
    var howlong = document.timer.reloadWindowValue.value * 1000; //convert to millis
    alert("setting to " + howlong + " milliseconds");
    setInterval(function() { location.reload() }, howlong);

//default reload
function reloadPage() {
    alert("reloading every " + howlong + " milliseconds");
    setInterval(function() { location.reload() }, howlong);

window.attachEvent("onload", reloadPage)

<form name="timer">
    Refresh page in: <input type="text" name="reloadWindowValue" size="3" value="5"> seconds
    <input type="button" value="set" onclick="setDelay();">