js獲取當前日期

yeahokay發表於2007-11-15
  1. function showDate()
  2. {
  3. var today = new Date();
  4. var day = today.getDate();
  5. var month = today.getMonth() + 1;
  6. var year = today.getYear();
  7. var date = year + "-" + month + "-" + day;
  8. document.getElementsByName(文字框的name)[0].value = date;
  9. }
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/786540/viewspace-982521/,如需轉載,請註明出處,否則將追究法律責任。

相關文章