»
EnglishFrenchVietnamese

Print - JavaScript Current Date Auto-Filling - JavaScriptBank.com

Full version: jsB@nk » Form » Textarea » JavaScript Current Date Auto-Filling
URL: https://www.javascriptbank.com/javascript-current-date-auto-filling.html

JavaScript Current Date Auto-Filling © JavaScriptBank.comLoad a web page with this implemented JavaScript code then your reserved input field will be filled by current date - this is idea of script's author. This JavaScript may help you in the manner of asking users to insert current date, for the invoices, mettings, ...This is a good JavaScript code example to know more date in JavaScript. If you need a JavaScript current time, please check: - Basic Date Display 2 - Current Date & Time (Short) - Current Date & Time (Long) - Simple Current Date script

Full version: jsB@nk » Form » Textarea » JavaScript Current Date Auto-Filling
URL: https://www.javascriptbank.com/javascript-current-date-auto-filling.html



JavaScript
<script type="text/javascript">// Created by: Jean P. May, Jr. | http://www.wideopenwest.com/~thebearmay// This script downloaded from www.JavaScriptBank.comfunction autoDate () {var tDay = new Date();var tMonth = tDay.getMonth()+1;var tDate = tDay.getDate();if ( tMonth < 10) tMonth = "0"+tMonth;if ( tDate < 10) tDate = "0"+tDate;document.getElementById("tDate").value = tMonth+"/"+tDate+"/"+tDay.getFullYear(); }// Multiple onload function created by: Simon Willison// http://simonwillison.net/2004/May/26/addLoadEvent/function addLoadEvent(func) {  var oldonload = window.onload;  if (typeof window.onload != 'function') {    window.onload = func;  } else {    window.onload = function() {      if (oldonload) {        oldonload();      }      func();    }  }}addLoadEvent(function() {  autoDate();});</script>


HTML
<input id="tDate" type="text" readonly="readonly" />