主页 > 孕期工具 >

预产期计算

来源:福州台江医院 阅读量:次
function haha() { if (document.health.year.value == "" || document.health.month.value == "" || document.health.day.value == "") { alert("请填写完整年月日!"); return false; } if (document.health.year.value > 2050 || document.health.year.value < 1990) { alert("请填写正确年份!"); document.health.year.focus(); return false; } if (document.health.month.value > 12 || document.health.month.value < 1) { alert("请填写正确月份!"); document.health.month.focus(); return false; } if (document.health.day.value > 31 || document.health.day.value < 1) { alert("请填写正确日子!"); document.health.day.focus(); return false; } if (!isDate(document.health.year.value, document.health.month.value, document.health.day.value)) { alert("年月日组合有错,请重新填写!"); return false; } function isDate(year, month, day) { // month argument must be in the range 1 - 12 month = month - 1; // javascript month range : 0- 11 var tempDate = new Date(year, month, day); if ((year2k(tempDate.getFullYear()) == year) && (month == tempDate.getMonth()) && (day == tempDate.getDate())) { return true; } else { return false; } } function year2k(d) { return (d < 1000) ? d + 1900 : d; } var addDays = (36+parseInt(document.health.mweek.value,10))*7; var m = parseInt(document.health.month.value,10)-1; var stime = new Date(document.health.year.value,m,parseInt(document.health.day.value,10)); var yuchan2 = new Date(document.health.year.value,m,parseInt(document.health.day.value,10)+addDays); var nowt = new Date(); var nowtime = nowt.getTime(); var chatime = nowtime - Date.parse(stime); var chaweek = Math.floor((chatime) / (1000 * 60 * 60 * 24 * 7)); if (chaweek < 0) chaweek = 0; if (chaweek > 43) alert("你的预产期已过!"); document.health.yuchan.value = yuchan2.format("yyyy年MM月dd日"); document.health.yuchan2.value = chaweek; } Date.prototype.format = function(format) { var o ={ 'M+' : this.getMonth()+1, //month 'd+' : this.getDate(), //day 'h+' : this.getHours(), //hour 's+' : this.getSeconds(), //second 'm+' : this.getMinutes(), //minute 'q+' : Math.floor((this.getMonth()+3)/3), //quarter 'S' : this.getMilliseconds() //millisecond }; if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(this.getFullYear()+'').substr(4 - RegExp.$1.length));} for(var k in o){ if(new RegExp('('+ k +')').test(format)){format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ('00'+ o[k]).substr((''+ o[k]).length));}} return format; };

预产期是从最后一次月经的第一天起算,到第200天。

平均月经周期:

末次月经:

测试结果
您的预产期是
您现在正处于孕期的第
免费自助挂号平台咨询专家
var myDate = new Date(); var yyDay = myDate.getDate(); var yyMonth = myDate.getMonth() + 1; var yyHours = myDate.getHours(); window.onload=function(){ oMonth = document.getElementById("month"); for(i=0;i
(本网站已加密,绝对保护个人隐私)
您的姓名:
您的电话: *
您的QQ: *
预约时间:
您的问题:

节假日不休 8:00-17:00(开诊)

医院地址:
福州市五一南路293号