JavaScript checks if date entered is older than 30 days and clearing input field if yes
<p>Thanks to all the other SO questions regarding javascript and comparing dates, I was able to come up with something that works well for my situation.  Now, I just need to clear the input field if the date entered is more than 30 days old.  </p>

<pre><code>function ChngStatusEffective(obj)
{
  p=/(\d{1,2})\/(\d{1,2})\/(\d{1,4})/;
  if (!obj.value.match(p)) return;
  num=new Array();
  num=obj.value.match(p);
  if (num[1].length == 1) num[1]="0" + num[1];
  if (num[2].length == 1) num[2]="0" + num[2];
  if (num[3].length == 1) num[3]="200" + num[3];
  if (num[3].length == 2) num[3]="20" + num[3];
  strValue= num[1] + "/" + num[2] + "/" + num[3];

    var today = new Date ();
    var Date2 = new Date (strValue);
    var Days = Math.floor((Date2.getTime() - today.getTime())/(1000*60*60*24));
    alert('Days between two dates is: ' + Days);
    if (Days &gt;= 0)
        {
            alert('Future dates are not allowed ' + Days);
            //  document.getElementByName('statuseffective').value();
            $('#stauseffective').val('');
            return false;
        }
    else if ((Days === -1) || (Days &gt; -31))
        {
            alert('Date entered looks good'  + Days );
        }
    else 
        {
            alert('Are you sure you entered the correct date? ' + Days);
        }
validateUSDate( strValue )
}
</code></pre>

<p>The function is called:</p>

<pre><code>&lt;input type="text" name="statuseffective" onchange="ChngStatusEffective(this)" /&gt;
</code></pre>

<p>I need only this input field name, <code>statuseffective</code> to be blanked.  <strong>NOTE</strong>:  there could be one input field or there could be 100.  I only need the one input field blanked.</p>
