宝哥软件园

JS通过系统时间限定动态添加选择选项的实例代码

编辑:宝哥软件园 来源:互联网 时间:2021-10-27

虽然是个简单的效果,还是需要积累一下,记录一下;

源代码如下所示:

选择id='myselect1 '选项值=' '—/选项值='2015级'2015级/option选项值='2014级'2014级/option选项值='2013级'2013级/option选项值='2012级'2012级/option/select brbr select id=' my select 2 '选项值=' '—/选项选项值='2015级'2015级/option选项值='2014级'2014级/option选项值='2013级'2013级/option选项值='2012级'2012级/option/选择var time=新日期();var month=time。get month()1;var day=time。getday();if(第5个月第1天){ var objSelect=document。getelementbyid(' my select 2 ');添加(新选项(' 2016级', '2016级'),1);objselect。选项。移除(5);} if(第7个月第1天){ var objSelect=document。getelementbyid(' my select 1 ');添加(新选项(' 2016级', '2016级'),1);objselect。选项。移除(5);}

更多资讯
游戏推荐
更多+