HTML / Javascript在IE浏览器中无效

时间:2016-05-09 22:49:05

标签: javascript html google-chrome

我遇到一些javascript的问题,我想把它放在我们当地的内部网站上供员工查看。它的作用是从阵列中拉出员工生日,如果他们的生日是今天,那么它就会在网站上显示他们的生日。问题是我的代码在Chrome中完美运行,但在IE中,即使生日与今天的日期相符,它也会显示“ - 无”。

感谢帮助人员。

<script language="JavaScript">

var arrBday = [
['Erica As','5/1'],
['Jacob C','5/4'],
['Rheann A','5/5'],
['Kim K','5/7'],
['James R','5/9'],
['Lee R','5/9'],
['Ryan W','5/13'],
['Angie E','5/19'],
['Eric H','5/22'],
['Gary B','5/24'],
['Jason T','5/24'],
['Kevin B','5/30'],
['Luis M','5/30'],
['Dale B','5/31']
];

function displayBdayList(today){
var bday,strList='';
for (var i=0;i<arrBday.length;i++){
bday = new Date(arrBday[i][1]);
if (!isNaN(bday) && bday.getMonth()==today.getMonth() && bday.getDate()==today.getDate()) 
strList+='- '+arrBday[i][0]+" <br>";
}
if (strList=='') strList='- None'
document.write("Today's Staff Birtdays:<br>"+strList)
}

displayBdayList(new Date());
</script>

0 个答案:

没有答案