首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

依据年份获取生肖

2012-10-08 
根据年份获取生肖script languageJavaScript!--window.onloadfunction(){?? ?var year new Array

根据年份获取生肖

<script language="JavaScript">

<!--

window.onload=function(){

?? ?var year = new Array("猪","鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗");

?? ?var y = new Array("猴","鸡","狗","猪","鼠","牛","虎","兔","龙","蛇","马","羊");

var i = document.getElementsByTagName("input")[0];

var s = document.getElementsByTagName("span")[0];

i.value="2010";

i.focus();

i.onkeyup=function(){

? ?s.innerHTML = year[(parseInt(this.value)+9)%12]+"|"+y[this.value%12];

}

}

//-->

</script>

热点排行