标签:parse 区间 ber 隐式 条件 返回 答案 mon logs
<script> var num=0; if(num%2==0 && num != 0){ console.log(num+"是偶数") }else if(num%2 != 0 && num != 0){ console.log(num+"是奇数") }else{ console.log(num+"既不是奇数也不是") } </script> 判断奇偶数
<!--根据一个数字日期,判断这个日期是这一年的第几天 例如: 20160211,计算后结果为42--> <input type="text" id="txt" value="" /> <input type="button" id="bnt" value="变" /> </body> </html> <script> bnt.onclick=function(){ var day=txt.value; var year=parseInt(day/10000); var month=parseInt(day%10000/100); var today=day%100; var towday=28; if ((year%4==0 && year/100!=0) || year/400==0) { towday=29; } switch(month){ case 12: today+=30; case 11: today+=31; case 10: today+=30; case 9: today+=31; case 8: today+=31; case 7: today+=30; case 6: today+=31; case 5: today+=30; case 4: today+=31; case 3: today+=towday; case 2: today+=31; case 1: alert(today); break; default: alert("你输入的号码有误") }
</script>
标签:parse 区间 ber 隐式 条件 返回 答案 mon logs
原文地址:http://www.cnblogs.com/qiuying/p/7372904.html