html编写的生理期计算器.docx

上传人:b****7 文档编号:9027194 上传时间:2023-02-02 格式:DOCX 页数:29 大小:19.34KB
下载 相关 举报
html编写的生理期计算器.docx_第1页
第1页 / 共29页
html编写的生理期计算器.docx_第2页
第2页 / 共29页
html编写的生理期计算器.docx_第3页
第3页 / 共29页
html编写的生理期计算器.docx_第4页
第4页 / 共29页
html编写的生理期计算器.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

html编写的生理期计算器.docx

《html编写的生理期计算器.docx》由会员分享,可在线阅读,更多相关《html编写的生理期计算器.docx(29页珍藏版)》请在冰豆网上搜索。

html编写的生理期计算器.docx

html编写的生理期计算器

--

BODY{font-family:

"宋体";font-size:

14px;}

td{table-layout:

fixed;word-break:

break-all;font-family:

"宋体";font-size:

12px}

TABLE{font-family:

Arial;font-size:

12px;color:

#000000}

a:

link{text-decoration:

none;color:

008040}

a:

visited{text-decoration:

none;color:

008040}

a:

hover{text-decoration:

underline;color:

red}

a:

active{text-decoration:

none;font-size:

12px;color:

red}

-->

妇女安全期测试

functionhero(){

varherowidth=480;//改为你要的网页宽度

varheroheight=490;//改为你要的网页高度

window.resizeTo(herowidth,heroheight);

}

hero();

--Hidethisscriptfromoldbrowsers--

if(!

document.layers&&!

document.all)

event="test"

functionshowtip2(current,e,text,index){

if(document.all&&document.readyState=="complete"){

eval("vartooltip=document.all.tooltip"+index+";")

//tooltip.innerHTML='

1pxsolidblack">'+text+''

tooltip.innerHTML=''+text+''

tooltip.style.pixelLeft=event.clientX+document.body.scrollLeft+10

tooltip.style.pixelTop=event.clientY+document.body.scrollTop+10

tooltip.style.visibility="visible"

}

elseif(document.layers){

eval("vartooltip=document.tooltip"+index+";")

eval("varnstip=document.tooltip"+index+".document.nstip"+index+";")

nstip.document.write(''+text+'')

nstip.document.close()

nstip.left=0

//currentscroll=setInterval("scrolltip("+index+")",100)

tooltip.left=e.pageX+10

tooltip.top=e.pageY+10

tooltip.visibility="show"

}

}

functionhidetip2(index){

if(document.all)

eval("document.all.tooltip"+index+".style.visibility='hidden';");

elseif(document.layers){

//clearInterval(currentscroll)

eval("document.tooltip"+index+".visibility='hidden';")

}

}

functionscrolltip(index){

eval("varnstip=document.tooltip"+index+".document.nstip"+index+";")

if(nstip.left>=-nstip.document.width)

nstip.left-=5

else

nstip.left=150

}

functionmontharr(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11)

{

this[0]=m0;

this[1]=m1;

this[2]=m2;

this[3]=m3;

this[4]=m4;

this[5]=m5;

this[6]=m6;

this[7]=m7;

this[8]=m8;

this[9]=m9;

this[10]=m10;

this[11]=m11;

}

varCalendarOuterHTML='';

varToday=newDate();

varDaysPerMonth=0;

//Getthenumberofdayinsomemonth

functionGetDayPerMonth(year,month)

{

varmonthDays=newmontharr(31,28,31,30,31,30,31,31,30,31,30,31);

if(((year%4==0)&&(year%100!

=0))||(year%400==0))

monthDays[1]=29;

DaysPerMonth=monthDays[month];

}

functionGetCalendarOuterHTML(CalendarIndex,HaveLayer)

{

CalendarOuterHTML='';

varthisYear=frmInput.txtYear.value;

varthisMonth=parseInt(frmInput.txtMonth.value)+CalendarIndex-1;

if(thisMonth>12)

{

thisYear=parseInt(frmInput.txtYear.value)+1;

thisMonth=thisMonth%12;

}

//titleofthecalendar

CalendarOuterHTML=CalendarOuterHTML+"";

CalendarOuterHTML=CalendarOuterHTML+"";

CalendarOuterHTML=CalendarOuterHTML+thisYear+'年';

CalendarOuterHTML=CalendarOuterHTML+thisMonth+'月';

CalendarOuterHTML=CalendarOuterHTML+"六";

CalendarOuterHTML=CalendarOuterHTML+"";

//GetthedayofthefirstDay

varfirstDay=newDate(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value)-2+CalendarIndex),1));

testMe=firstDay.getDate();

if(testMe==2)

firstDay.setDate(0);

startDay=firstDay.getDay();

//displayemptycellsbeforethefirstdayofthemonth

column=0;

for(i=0;i

{

CalendarOuterHTML=CalendarOuterHTML+"";

column++;

}

//displaythegridsinthecalendar

varLastday=newDate(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value)-1),frmInput.txtDay.value))

GetDayPerMonth(thisYear,thisMonth-1)

for(i=1;i<=DaysPerMonth;i++)

{

CalendarOuterHTML=CalendarOuterHTML+"";

varcolor="blue";//defaultcolorwithoutlayerdisplayed

//GetlayerHTML

if(HaveLayer)

{

varThisDay=newDate(Date.UTC(thisYear,thisMonth-1,i))

varmsPerDay=24*60*60*1000;

varmensesCyc=parseInt(frmInput.txtMinMensesCyc.value);//MinmensesCycle

varmsDiff=ThisDay.getTime()-Lastday.getTime();

dayDiff=Math.floor(msDiff/msPerDay);//getthedaysbetweenthisdayandlastday

dayRemainder=(dayDiff%mensesCyc+mensesCyc)%mensesCyc;

//if(i<2){alert(ThisDay.toLocaleString());alert(Lastday.toLocaleString());alert(dayDiff);alert(dayRemainder);}

vartooltips="";//contentoflayer

if(dayRemainder>=0&&dayRemainder<=4)

{color="#FF9900";

tooltips="这是月经期,要注意经期卫生,当然也要“节欲”,避免性事哦!

"

}

if(dayRemainder>=5&&dayRemainder<=(mensesCyc-20))

{color="#009933";

tooltips="这是安全期,性事一般不会受孕,您放心吧!

";

}

if(dayRemainder>=(mensesCyc-19)&&dayRemainder<=(mensesCyc-10))

{color="#FF3300";

tooltips="这是危险期,亦称排卵期,性事受孕可能性大,千万要注意哦!

";

}

if(dayRemainder>=(mensesCyc-9)&&dayRemainder<=(mensesCyc-1))

{color="#009933";

tooltips="这是安全期,性事一般不会受孕,您放心吧!

";

}

iLayerIndex=40*CalendarIndex+i;//indexoflayer

tooltips=""+

"

white;COLOR:

"+color+";FONT-FAMILY:

宋体;FONT-SIZE:

9pt;TEXT-DECORATION:

none>"+

tooltips+"";

CalendarOuterHTML=CalendarOuterHTML+"

absolute;visibility:

hidden;clip:

rect(01501500);width:

150px;background-color:

seashell\">";

CalendarOuterHTML=CalendarOuterHTML+"

";

CalendarOuterHTML=CalendarOuterHTML+"";

}

CalendarOuterHTML=CalendarOuterHTML+""+i+"";

column++;

if(column==7)

{

CalendarOuterHTML=CalendarOuterHTML+"";

column=0;

}

}

//displayemptycellsafterthefinaldayofthemonth

varFinalDay=newDate(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value)-2+CalendarIndex),DaysPerMonth));

testMe=FinalDay.getDate();

if(testMe==2)

FinalDay.setDate(0);

EndDay=FinalDay.getDay();

for(i=EndDay;i<6;i++)

{

CalendarOuterHTML=CalendarOuterHTML+"";

}

CalendarOuterHTML=CalendarOuterHTML+"";

}

//tocheckinputerrorsanddisplaybothcalendars

functionDisplayCalendar()

{

//checkwhetherthedateislegal

if(frmInput.txtYear.value<1900||isNaN(frmInput.txtYear.value))

{

alert("请输入合法年份!

")

frmInput.txtYear.focus();

returnfalse;

}

if(isNaN(frmInput.txtMonth.value)||frmInput.txtMonth.value<1||frmInput.txtMonth.value>12)

{

alert("请输入合法月份!

")

frmInput.txtMonth.focus();

returnfalse;

}

GetDayPerMonth(frmInput.txtYear.value,frmInput.txtMonth.value-1)

if(isNaN(frmInput.txtDay.value)||frmInput.txtDay.value<1||frmInput.txtDay.value>DaysPerMonth)

{

alert("请输入合法日期!

")

frmInput.txtDay.focus();

returnfalse;

}

varLastday=newDate(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value)-1),frmInput.txtDay.value))

if((Today.getTime()-Lastday.getTime())<0)

{

alert("请输入正确的上次月经时间(不能早于当前时间)!

")

frmInput.txtYear.focus();

returnfalse;

}

//checkinput

if(isNaN(frmInput.txtMinMensesCyc.value))

{

alert("请输入数字!

")

frmInput.txtMinMensesCyc.focus();

returnfalse;

}

if(parseInt(frmInput.txtMinMensesCyc.value)>40||parseInt(frmInput.txtMinMensesCyc.value)<24)

{

alert("您输入的最短月经周期与标准月经周期相差太大,程序无法测试,请仔细核对。

\n\n如输入确无问题请咨询医生!

")

frmInput.txtMinMensesCyc.focus();

returnfalse;

}

if(isNaN(frmInput.txtMaxMensesCyc.value)||parseInt(frmInput.txtMaxMensesCyc.value)

{

alert("输入错误,请仔细核对您的输入周期!

");

frmInput.txtMaxMensesCyc.focus();

returnfalse;

}

//displaycalendars

GetCalendarOuterHTML(1,1);

document.all.Calendar1.outerHTML=CalendarOuterHTML;

GetCalendarOuterHTML(2,1);

document.all.Calendar2.outerHTML=CalendarOuterHTML;

}

//Initialize

functionInitialCalendar()

{

//Initializethedateinputboxes

frmInput.txtYear.value=Today.getYear();

frmInput.txtMonth.value=Today.getMonth()+1;

frmInput.txtDay.value=Today.getDate();

//Initializethecalendars

Ge

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 初中教育 > 理化生

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1