<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<title>时间</title>
<script type="text/javascript">
$(function(){
initdate();
});
//格式化日期函数
function formatedate(date){
if(date instanceof date){
var time=date.getmonth()+1;
var day=date.getdate();
if(day==31){
var mydate = new date(date.getfullyear(),date.getmonth(), 0);
date.setdate(mydate.getdate());
time=time-1;
if(time==0){
time=time+1;
}
}
if(time<10){
time="0"+time;
}
return date.getfullyear()+""+time;
} else {
return "error date";
}
}
//页面加载完成后,执行初始化操作
function initdate(){
//当前日期
var date = new date();
//获取select元素
$("#dateselect").empty().append("<option value=''></option>");
for (var i = 0; i < 6; i++) {
$("#dateselect").append(
"<option value='" + formatedate(date) + "'>"
+ formatedate(date) + "</option>");
//日期减一个月
date.setmonth(date.getmonth() - 1);
}
};
</script>
</head>
<body>
<div style="width:600px;height: 600px">
<select name="accountdate" id="dateselect" class="form-control select2" style="width: 100%;">
</select>
</div>
</body>
</html>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号