最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery實(shí)現(xiàn)根據(jù)生日計(jì)算年齡 星座 生肖

 更新時(shí)間:2016年11月23日 10:18:50   作者:逆心  
本篇文章主要是對(duì)利用jQuery實(shí)現(xiàn)根據(jù)生日計(jì)算年齡,星座,生肖的示例代碼進(jìn)行了介紹,需要的朋友可以過來(lái)參考下
<html>
<head>
 <title></title>
 <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>

 <script type="text/javascript">
 //根據(jù)輸入的生日自動(dòng)獲取星座,生肖和年齡。
 var year = new Array("豬", "鼠", "牛", "虎", "兔", "龍", "蛇", "馬", "羊", "猴", "雞", "狗");
 jQuery(function () {
  $("#Birthday").blur(function () {
  setTimeout(function () {
   var strHtml = "";
   var date = new Date($("#Birthday").val().replace(/-/g, "/"));
   var con = getxingzuo(date.getMonth() + 1, date.getDate());
   strHtml += "你的星座是:" + con;
   var zodiac = year[(parseInt(date.getFullYear()) + 9) % 12];
   strHtml += "<br/>你的生肖是:" + zodiac;
   var Age = new Date().getFullYear() - date.getFullYear();
   strHtml += "<br/>你的年齡是:" + Age;
   $("#div1").append(strHtml);
  }, 200);
  })
 })
 function getxingzuo(month, day) {
  var d = new Date(1999, month - 1, day, 0, 0, 0);
  var arr = [];
  arr.push(["魔羯座", new Date(1999, 0, 1, 0, 0, 0)])
  arr.push(["水瓶座", new Date(1999, 0, 20, 0, 0, 0)])
  arr.push(["雙魚座", new Date(1999, 1, 19, 0, 0, 0)])
  arr.push(["牡羊座", new Date(1999, 2, 21, 0, 0, 0)])
  arr.push(["金牛座", new Date(1999, 3, 21, 0, 0, 0)])
  arr.push(["雙子座", new Date(1999, 4, 21, 0, 0, 0)])
  arr.push(["巨蟹座", new Date(1999, 5, 22, 0, 0, 0)])
  arr.push(["獅子座", new Date(1999, 6, 23, 0, 0, 0)])
  arr.push(["處女座", new Date(1999, 7, 23, 0, 0, 0)])
  arr.push(["天秤座", new Date(1999, 8, 23, 0, 0, 0)])
  arr.push(["天蝎座", new Date(1999, 9, 23, 0, 0, 0)])
  arr.push(["射手座", new Date(1999, 10, 22, 0, 0, 0)])
  arr.push(["魔羯座", new Date(1999, 11, 22, 0, 0, 0)])
  for (var i = arr.length - 1; i >= 0; i--) {
  if (d >= arr[i][1]) return arr[i][0];
  }
 }
 </script>
</head>
<body>
 <div id="div1" style="width:200px;height:200px;">
  <input type="text" id="Birthday" value="請(qǐng)輸入你的生日!" />
  <input type="button" value="開始計(jì)算" />
 </div>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家有所幫助,謝謝對(duì)腳本之家的支持!

相關(guān)文章

最新評(píng)論

东城区| 竹溪县| 松溪县| 平利县| 桐柏县| 金昌市| 平和县| 舞钢市| 磐石市| 扶沟县| 山东省| 丹阳市| 长沙县| 密山市| 申扎县| 宜宾县| 稻城县| 高青县| 双流县| 乌苏市| 政和县| 万宁市| 称多县| 临高县| 富宁县| 澎湖县| 抚松县| 永年县| 色达县| 玛曲县| 佛学| 衡水市| 二连浩特市| 水富县| 银川市| 凤凰县| 固阳县| 莱州市| 兴和县| 江油市| 嵩明县|