Load a jsp page every 20 secs after 1st page load

I am trying to autosubmit a form upon 1st load and then refresh every 20 secs. I have tried below but it keeps loading the page all the time. is that correct implementation or how I can achieve that.

 window.onload=function(){
    var auto = setTimeout(function(){ submitform(); }, 100);

    function submitform(){
      document.forms["frm1"].submit();
    }

    function autoRefresh(){
       clearTimeout(auto);
       auto = setTimeout(function(){ autoRefresh(); }, 20000);
    }
}