title: Javascript only allow certain format
body: <p>the title states my question..here's the supposed format</p>
  
  <pre><code>&lt;input type="text" value="2010-12414" onkeyup="isformat(this)"&gt;
  </code></pre>
  
  <p>and the script i have is this</p>
  
  <pre><code>function isformat(ele)
                  {
                     var r=/\D-\D$/i;
                     if(r.test(ele.value))
                      {
                           alert("This Field allows Only Numerics.");
                           ele.value="";
                          ele.focus();
                       }
                  }
  </code></pre>
  
  <p>i'm not sure if it is the correct argument. Any suggestions? thanks in advance.</p>