Go to Date WordPress Widget

This is the widget code to have a Go to Date widget in WordPress. It requires the correct permalink structure, but it is easy to paste into a text widget and it works nicely.

<script type="text/javascript">

function gotodate() {
  var baseurl = "http://example.com/index.php/"
  
  var y = document.getElementById("year").value;
  var m = document.getElementById("month").value;
  var d = document.getElementById("day").value;
  //debug alert(y + m + d);
  
  var newloc = baseurl + y + "/" + m + "/" + d
  window.location = newloc
}



<form>
  <table>
    <tr>
      <td>Year:</td>
      <td>Month:</td>
      <td>Day:</td>
      <td> </td>
    </tr>
    <tr>
      <td><input type="text" id="year" size="4" maxlength="4" /></td>
      <td><input type="text" id="month" size="2" maxlength="2" /></td>
      <td><input type="text" id="day" size="2" maxlength="2" /></td>
      <td><input type="button" value="Go" onclick="javascript:gotodate();" /></td>
    </tr>
</table>
</form>