求JS脚本 获取当前的年份 从本年起 显示上10年的年份 开始要以请选择 下面是年份 绑定在DropDownList

求JS脚本 获取当前的年份 从本年起 显示上10年的年份 开始要以请选择 下面是年份 绑定在DropDownList,第1张

方法1:DropDownListr 在HTML画面上显示的是 <select> 可以在客户端

//现在是2000年后 可取的 年份4位数。

var d = new Date()

dgetYear()

方法取得当前年份并 插入在 <select>里

可用DropDownListrclientID

方法2:用ajax取得 客户端年份 并绑定DropDownList

方法3:直接在后台绑定数据。

<script src="/Scripts/SetYearjs" type="text/javascript"></script>

<script type="text/javascript" language="javascript">

var curColor;

var fontColor;

function mouseover(obj) {

curColor = objstylebackgroundColor;

fontColor = objstylecolor;

objstylebackgroundColor = "#CC0000";

objstylecolor = "White";

objstylecursor = 'pointer'; objstylecursor = 'hand';

}

function mousemove(obj) {

objstylecursor = 'pointer'; objstylecursor = 'hand';

}

function mouseout(obj) {

objstylebackgroundColor = curColor;

objstylecolor = fontColor;

}

function _SetTime2(tt) {

onclick_SetYear(tt);

}

function addListener(element, e, fn) {

if (elementaddEventListener) {

elementaddEventListener(e, fn, false);

} else {

elementattachEvent("on" + e, fn);

}

}

addListener(document, "click",

function (evt) {

var evt = windowevent  windowevent : evt,

target = evtsrcElement || evttarget;

if (targetid == "txtYear" || targetid == "img_left" || targetid == "img_right" || targetid == "title") {

documentgetElementById("_top")styledisplay = "";

documentgetElementById("_contents")styledisplay = "";

} else {

while (targetnodeNametoLowerCase() != "div" && targetnodeNametoLowerCase() != "html") {

target = targetparentNode;

}

if (targetid == "_top" || targetid == "_contents") {

documentgetElementById("_top")styledisplay = "";

documentgetElementById("_contents")styledisplay = "";

}

else {

documentgetElementById("_top")styledisplay = "none";

documentgetElementById("_contents")styledisplay = "none";

}

}

})

</script>

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<meta ;

详细链接

以上就是关于求JS脚本 获取当前的年份 从本年起 显示上10年的年份 开始要以请选择 下面是年份 绑定在DropDownList全部的内容,包括:求JS脚本 获取当前的年份 从本年起 显示上10年的年份 开始要以请选择 下面是年份 绑定在DropDownList、用JavaScript实现年份选择、JS怎么通过身份z号码获取出生年月日并判断出生年月格式是否正确等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/9404610.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存