<script src="../Scripts/SetYear.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
var curColor
var fontColor
function mouseover(obj) {
curColor = obj.style.backgroundColor
fontColor = obj.style.color
obj.style.backgroundColor = "#CC0000"
obj.style.color = "White"
obj.style.cursor = 'pointer' obj.style.cursor = 'hand'
}
function mousemove(obj) {
obj.style.cursor = 'pointer' obj.style.cursor = 'hand'
}
function mouseout(obj) {
obj.style.backgroundColor = curColor
obj.style.color = fontColor
}
function _SetTime2(tt) {
onclick_SetYear(tt)
}
function addListener(element, e, fn) {
if (element.addEventListener) {
element.addEventListener(e, fn, false)
} else {
element.attachEvent("on" + e, fn)
}
}
addListener(document, "click",
function (evt) {
var evt = window.event ? window.event : evt,
target = evt.srcElement || evt.target
if (target.id == "txtYear" || target.id == "img_left" || target.id == "img_right" || target.id == "title") {
document.getElementById("_top").style.display = ""
document.getElementById("_contents").style.display = ""
} else {
while (target.nodeName.toLowerCase() != "div" && target.nodeName.toLowerCase() != "html") {
target = target.parentNode
}
if (target.id == "_top" || target.id == "_contents") {
document.getElementById("_top").style.display = ""
document.getElementById("_contents").style.display = ""
}
else {
document.getElementById("_top").style.display = "none"
document.getElementById("_contents").style.display = "none"
}
}
})
</script>
var date = new Date()// new 一个Date对象var year = date.getFullYear()// 年份
var month = date.getMonth() + 1// 月份(<a href="https://www.baidu.com/s?wd=%E4%BB%8E0%E5%BC%80%E5%A7%8B&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Ykuj0vnWR3nHnvujF-nvD40ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHbdrH0LPHc4P1RYnWTsP1Rsn0" target="_blank" class="baidu-highlight">从0开始</a>,所以应+1)
for(var i = monthi >month - 6i--) {
$("<option value=''>" + year + "年" + i + "月" + "</option>").appendTo($("select"))// 依次添加下拉框选项,value自定义,右边的appendTo参数为目标选择框
}