Basic Javascript Question - What trigger to use?
<p>I'm using this script to auto populate my date field on a form:</p>

<pre><code>function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

function zp(n){
return n&lt;10?("0"+n):n;
}
function insertDate(t,format){
var now=new Date();
var DD=zp(now.getDate());
var MM=zp(now.getMonth()+1);
var YYYY=now.getFullYear();
var YY=zp(now.getFullYear()%100);
format=format.replace(/DD/,DD);
format=format.replace(/MM/,MM);
format=format.replace(/YYYY/,YYYY);
format=format.replace(/YY/,YY);
t.value=format;
}
</code></pre>

<p>Then using this to trigger the event:</p>

<pre><code>onfocus="insertDate(this,'DD/MM/YYYY')"
</code></pre>

<p>My question (which is probably a basic one!) is what should I use to auto populate the field when the page loads rather than when I click on the field?</p>
