<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<title></title>
</head>
<body>
<input type="text" name="alertDateQuery" id="aDate">
</body>
<script type="text/javascript">
var mydateInput = document.getElementById("aDate");
var date = new Date();
//var dateString = date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();//此语句当月份小于10月时,只有一位
//下面语句判断,当月份小于10月时,前面位0
var Y = date.getFullYear();
var M = date.getMonth() + 1;
if( M < 10){
M = '0' + M;
}
var D = date.getDate();
var dateString = Y + "-" + M + "-" + D;
mydateInput.value = dateString;
</script>
</html>