<
HTML
>
< HEAD >
< TITLE > 女性安全期测试 </ TITLE >
< META HTTP-EQUIV ="Content-Type" CONTENT ="text/html; charset=gb2312" >
< style type ="text/css" >
<!--
a { text-decoration : none }
a:hover { text-decoration : underline ; color : #0000ff }
A:active { color : #FF0099 }
table { font-family : "宋体" ; font-size : 9pt }
.nine-pt { font-family : "宋体" ; font-size : 9pt }
.inputform { border : 1px double ; border-color : #000000 ; font-family : "宋体" ; font-size : 9pt }
.titletext { FONT-SIZE : 14.8px ; FONT-FAMILY : "宋体" ; LETTER-SPACING : 6px ; }
INPUT { background : #efefff ; BORDER-TOP-WIDTH : 1px ; PADDING-RIGHT : 1px ; PADDING-LEFT : 1px ; BORDER-LEFT-WIDTH : 1px ; FONT-SIZE : 9pt ; BORDER-LEFT-COLOR : #cccccc ; BORDER-BOTTOM-WIDTH : 1px ; BORDER-BOTTOM-COLOR : #cccccc ; PADDING-BOTTOM : 1px ; BORDER-TOP-COLOR : #cccccc ; PADDING-TOP : 1px ; HEIGHT : 18px ; BORDER-RIGHT-WIDTH : 1px ; BORDER-RIGHT-COLOR : #cccccc }
-->
</ style >
< script language ="JavaScript" >
<!-- Hide this script from old browsers --
if ( ! document.layers &&! document.all)
event = " test "
function showtip2(current,e,text,index){
if (document.all && document.readyState == " complete " ){
eval( " var tooltip=document.all.tooltip " + index + " ; " )
// tooltip.innerHTML='<marquee style="border:1px solid black">'+text+'</marquee>'
tooltip.innerHTML = '' + text + ' </ TABLE > '
tooltip.style.pixelLeft = event.x - 195
tooltip.style.pixelTop = event.y - 130
tooltip.style.visibility = " visible "
}
else if (document.layers){
eval( " var tooltip=document.tooltip " + index + " ; " )
eval( " var nstip=document.tooltip " + index + " .document.nstip " + index + " ; " )
nstip.document.write(' < b > ' + text + ' </ b > ')
nstip.document.close()
nstip.left = 0
// currentscroll=setInterval("scrolltip(" + index + ")",100)
tooltip.left = event.x - 195
tooltip.top = event.y - 130
tooltip.visibility = " show "
}
}
function hidetip2(index){
if (document.all)
eval( " document.all.tooltip " + index + " .style.visibility='hidden'; " );
else if (document.layers){
// clearInterval(currentscroll)
eval( " document.tooltip " + index + " .visibility='hidden'; " )
}
}
function scrolltip(index){
eval( " var nstip=document.tooltip " + index + " .document.nstip " + index + " ; " )
if (nstip.left >=- nstip.document.width)
nstip.left -= 5
else
nstip.left = 150
}
function montharr(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;
}
var CalendarOuterHTML = '';
var Today = new Date();
var DaysPerMonth = 0 ;
// Get the number of day in some month
function GetDayPerMonth(year,month)
{
var monthDays = new montharr( 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];
}
function GetCalendarOuterHTML(CalendarIndex,HaveLayer)
{
CalendarOuterHTML = '';
var thisYear = frmInput.txtYear.value;
var thisMonth = parseInt(frmInput.txtMonth.value) + CalendarIndex - 1 ;
// when thisMonth beyond 12
if (thisMonth > 12 )
{
thisYear = parseInt(thisYear) + 1 ;
thisMonth = thisMonth % 12 ;
}
// title of the calendar
CalendarOuterHTML = CalendarOuterHTML + " <table border=0 cellspacing=0 cellpadding=3 align=right id=Calendar " + CalendarIndex + " > " ;
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#84C1FF><TD colspan=7 class=nine-pt height=15 align=center> " ;
CalendarOuterHTML = CalendarOuterHTML + thisYear + ' 年 ';
CalendarOuterHTML = CalendarOuterHTML + thisMonth + ' 月';
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#CAE4FF><TD width=18 class=nine-pt>日<TD width=18 class=nine-pt>一<TD width=18 class=nine-pt>二<TD width=18 class=nine-pt>三<TD width=18 class=nine-pt>四<TD width=18 class=nine-pt>五<TD width=18 class=nine-pt>六 " ;
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#FFFFFF> " ;
// Get the day of the first Day
var firstDay = new Date(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value) - 2 + CalendarIndex), 1 ));
testMe = firstDay.getDate();
if (testMe == 2 )
firstDay.setDate( 0 );
startDay = firstDay.getDay();
// display empty cells before the first day of the month
column = 0 ;
for (i = 0 ; i < startDay; i ++ )
{
CalendarOuterHTML = CalendarOuterHTML + " <TD width=18 class=nine-pt> " ;
column ++ ;
}
// display the grids in the calendar
var Lastday = new Date(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 + " <TD width=18 class=nine-pt> " ;
var color = " blue " ; // default color without layer displayed
// Get layer HTML
if (HaveLayer)
{
var ThisDay = new Date(Date.UTC(thisYear,thisMonth - 1 ,i))
var msPerDay = 24 * 60 * 60 * 1000 ;
var mensesCyc = parseInt(frmInput.txtMinMensesCyc.value); // Min menses Cycle
var msDiff = ThisDay.getTime() - Lastday.getTime();
dayDiff = Math.floor(msDiff / msPerDay); // get the days between thisday and lastday
dayRemainder = (dayDiff % mensesCyc + mensesCyc) % mensesCyc;
// if (i<2) {alert(ThisDay.toLocaleString()); alert(Lastday.toLocaleString()); alert(dayDiff);alert(dayRemainder);}
var tooltips = "" ; // content of layer
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 ; // index of layer
tooltips = " <TABLE border=0 cellPadding=2 cellSpacing=1 width=100% align=center bgcolor=#008080> " +
" <TR><TD style=BACKGROUND-COLOR:white;COLOR: " + color + " ;FONT-FAMILY:宋体;FONT-SIZE:9pt;TEXT-DECORATION:none> " +
tooltips + " </TD></TR></TABLE> " ;
CalendarOuterHTML = CalendarOuterHTML + " <div id=\ " tooltip " + iLayerIndex + " \ " style=\ " position:absolute;visibility:hidden;clip:rect( 0 150 150 0 );width:150px;background - color:seashell\ " > " ;
CalendarOuterHTML = CalendarOuterHTML + " <layer name=\ " nstip " + iLayerIndex + " \ " width=\ " 1000px\ " bgColor=\ " seashell\ " height=\ " 500px\ " ></layer></div> " ;
CalendarOuterHTML = CalendarOuterHTML + " <a href=\ " #\ " onMouseOver=\ " showtip2( this ,event,' " + tooltips + " ', " + iLayerIndex + " )\ " onMouseOut=\ " hidetip2( " + iLayerIndex + " )\ " > " ;
}
CalendarOuterHTML = CalendarOuterHTML + " <FONT COLOR=\ "" + color + " \ " > " + i + " </FONT> " ;
column ++ ;
if (column == 7 )
{
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#FFFFFF> " ;
column = 0 ;
}
}
// display empty cells after the final day of the month
var FinalDay = new Date(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 + " <TD width=18 class=nine-pt> " ;
}
CalendarOuterHTML = CalendarOuterHTML + " </TABLE> " ;
}
// to check input errors and display both calendars
function DisplayCalendar()
{
// check whether the date is legal
if (frmInput.txtYear.value < 1900 || isNaN(frmInput.txtYear.value))
{
alert( " 请输入合法年份! " )
frmInput.txtYear.focus();
return false ;
}
if (isNaN(frmInput.txtMonth.value) || frmInput.txtMonth.value < 1 || frmInput.txtMonth.value > 12 )
{
alert( " 请输入合法月份! " )
frmInput.txtMonth.focus();
return false ;
}
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();
return false ;
}
var Lastday = new Date(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value) - 1 ),frmInput.txtDay.value))
if ((Today.getTime() - Lastday.getTime()) < 0 )
{
alert( " 请输入正确的上次月经时间(不能早于当前时间)! " )
frmInput.txtYear.focus();
return false ;
}
// check input
if (isNaN(frmInput.txtMinMensesCyc.value))
{
alert( " 请输入数字! " )
frmInput.txtMinMensesCyc.focus();
return false ;
}
if (parseInt(frmInput.txtMinMensesCyc.value) > 40 || parseInt(frmInput.txtMinMensesCyc.value) < 22 )
{
alert( " 您输入的最短月经周期与标准月经周期相差太大,程序无法测试,请仔细核对。\n\n如输入确无问题请咨询医生! " )
frmInput.txtMinMensesCyc.focus();
return false ;
}
if (isNaN(frmInput.txtMaxMensesCyc.value) || parseInt(frmInput.txtMaxMensesCyc.value) < parseInt(frmInput.txtMinMensesCyc.value))
{
alert( " 输入错误,请仔细核对您的输入周期! " );
frmInput.txtMaxMensesCyc.focus();
return false ;
}
// display calendars
GetCalendarOuterHTML( 1 , 1 );
document.all.Calendar1.outerHTML = CalendarOuterHTML;
GetCalendarOuterHTML( 2 , 1 );
document.all.Calendar2.outerHTML = CalendarOuterHTML;
MM_showHideLayers('Layer1','','show');
}
// Initialize
function InitialCalendar()
{
// Initialize the date input boxes
frmInput.txtYear.value = Today.getYear();
frmInput.txtMonth.value = Today.getMonth() + 1 ;
frmInput.txtDay.value = Today.getDate();
// Initialize the calendars
GetCalendarOuterHTML( 1 , 0 );
document.all.Calendar1.outerHTML = CalendarOuterHTML;
GetCalendarOuterHTML( 2 , 0 );
document.all.Calendar2.outerHTML = CalendarOuterHTML;
// Set focus
frmInput.btnCalculate.focus();
}
// -- End Hiding Here -->
</ script >
< script language ="JavaScript" >
<!--
<!--
function MM_reloadPage(init) { // reloads the window if Nav4 resized
if (init == true ) with (navigator) { if ((appName == " Netscape " ) && (parseInt(appVersion) == 4 )) {
document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage; }}
else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
}
MM_reloadPage( true );
// -->
function MM_findObj(n, d) { // v4.0
var p,i,x; if ( ! d) d = document; if ((p = n.indexOf( " ? " )) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1 )].document; n = n.substring( 0 ,p);}
if ( ! (x = d[n]) && d.all) x = d.all[n]; for (i = 0 ; ! x && i < d.forms.length;i ++ ) x = d.forms[i][n];
for (i = 0 ; ! x && d.layers && i < d.layers.length;i ++ ) x = MM_findObj(n,d.layers[i].document);
if ( ! x && document.getElementById) x = document.getElementById(n); return x;
}
function MM_showHideLayers() { // v3.0
var i,p,v,obj,args = MM_showHideLayers.arguments;
for (i = 0 ; i < (args.length - 2 ); i += 3 ) if ((obj = MM_findObj(args[i])) != null ) { v = args[i + 2 ];
if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible':(v = 'hide') ? 'hidden':v; }
obj.visibility = v; }
}
function MM_swapImgRestore() { // v3.0
var i,x,a = document.MM_sr; for (i = 0 ;a && i < a.length && (x = a[i]) && x.oSrc;i ++ ) x.src = x.oSrc;
}
function MM_preloadImages() { // v3.0
var d = document; if (d.images){ if ( ! d.MM_p) d.MM_p = new Array();
var i,j = d.MM_p.length,a = MM_preloadImages.arguments; for (i = 0 ; i < a.length; i ++ )
if (a[i].indexOf( " # " ) != 0 ){ d.MM_p[j] = new Image; d.MM_p[j ++ ].src = a[i];}}
}
function MM_swapImage() { // v3.0
var i,j = 0 ,x,a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0 ;i < (a.length - 2 );i += 3 )
if ((x = MM_findObj(a[i])) != null ){document.MM_sr[j ++ ] = x; if ( ! x.oSrc) x.oSrc = x.src; x.src = a[i + 2 ];}
}
// -->
</ script >
</ HEAD >
< BODY BGCOLOR =#FFFFFF onload ="javascript:InitialCalendar();MM_preloadImages('img/close_o.gif')" >
< script language ="JavaScript" >
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false ;
return false ;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3 )
return false ;
}
else
if (event.button == 2 || event.button == 3 )
{
event.cancelBubble = true
event.returnValue = false ;
return false ;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
// -->
</ script >
< div id ="Layer1" style ="position:absolute; left:205px; top:155px; width:337px; height:307px; z-index:2; visibility: hidden" >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="3" align ="center" height ="250" bgcolor ="#FFCCFF" >
< tr >
< td bgcolor ="#FFCCFF" align ="center" class ="titletext" >
< table width ="100%" border ="0" cellspacing ="0" cellpadding ="0" >
< tr >
< td width ="95%" class ="titletext" align ="center" > 结果显示 </ td >
< td width ="5%" >< a href ="#" onMouseOut ="MM_swapImgRestore()" onMouseOver ="MM_swapImage('Image1','','img/close_o.gif',1)" >< img name ="Image1" border ="0" src ="img/close_d.gif" width ="11" height ="11" onClick ="MM_showHideLayers('Layer1','','hide')" ></ a ></ td >
</ tr >
</ table >
</ td >
</ tr >
< tr >
< td bgcolor ="#EEF7FF" align ="center" >
< table width ="360" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr valign ="top" >
< td height ="66" class ="nine-pt" width ="169" valign ="top" >
< table border ="0" cellspacing ="0" cellpadding ="3" id =Calendar1 >
</ table >
</ td >
< td height ="66" class ="nine-pt" width ="191" valign ="top" >
< table border ="0" cellspacing ="0" cellpadding ="3" align ="right" id =Calendar2 >
</ table >
</ td >
</ tr >
</ table >< br >
< table width ="256" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr class ="nine-pt" >
< td width ="89" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#009933" width ="30" > </ td >
< td width ="47" > 安全期 </ td >
</ tr >
</ table >
</ td >
< td width ="85" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#FF3300" width ="30" > </ td >
< td width ="47" > 危险期 </ td >
</ tr >
</ table >
</ td >
< td width ="82" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#FFCC00" width ="30" > </ td >
< td width ="47" > 月经期 </ td >
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ div >
< table border ="1" cellspacing ="0" cellpadding ="2" align ="center" bordercolor ="#666699" >
< tr >
< td bordercolor ="#FFFFFF" align ="center" class ="titletext" bgcolor ="#EEF7FF" >< font color ="#0066CC" > 女性安全期测试 </ font ></ td >
</ tr >
< tr >
< td bordercolor ="#FFFFFF" align ="center" >
< form method ="post" action ="#" name =frmInput onsubmit ="javascript:DisplayCalendar();" >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="2" bordercolorlight ="#666666" align ="center" bordercolordark ="#FFFFFF" bordercolor ="#000000" >
< tr bgcolor ="#D2E9FF" >
< td rowspan ="2" class ="nine-pt" height ="14" width ="80" align ="center" >
月经周期设置 </ td >
< td class ="nine-pt" height ="12" colspan ="3" width ="266" > 最短月经周期
< input type ="text" name ="txtMinMensesCyc" size ="2" maxlength =2 class ="inputform" value ="28" >
天 </ td >
</ tr >
< tr bgcolor ="C6EB4C" >
< td colspan ="3" class ="nine-pt" height ="2" width ="266" bgcolor ="#D2E9FF" > 最长月经周期
< input type ="text" name ="txtMaxMensesCyc" size ="2" maxlength =2 class ="inputform" value ="28" >
天 </ td >
</ tr >
</ table >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="2" bordercolorlight ="#666666" align ="center" bordercolordark ="#FFFFFF" bordercolor ="#000000" >
< tr bgcolor ="#D2E9FF" >
< td width ="80" class ="nine-pt" height ="2" align ="center" bgcolor ="#D2E9FF" > 上次月经时间 </ td >
< td colspan ="3" class ="nine-pt" height ="2" width ="266" bgcolor ="#D2E9FF" >
< input type ="text" name ="txtYear" size ="4" maxlength =4 class ="inputform" >
年
< input type ="text" name ="txtMonth" size ="2" maxlength =2 class ="inputform" >
月
< input type ="text" name ="txtDay" size ="2" maxlength =2 class ="inputform" >
日 </ td >
</ tr >
</ table >
< table width ="359" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr >
< td height ="38" bgcolor ="#D2E9FF" >
< div align ="center" >
< input type ="button" name ="Submit3" value ="设置完成" class ="nine-pt" onClick ="javascript:DisplayCalendar();" >
< input type ="button" name ="btnCalculate" value ="开始计算" class ="nine-pt" onClick ="javascript:DisplayCalendar();" >
< input type ="reset" name ="reset" value ="重新输入" class ="nine-pt" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< span class ="nine-pt" >< font color ="#999999" > 帮助:请先设置好周期后和时间后,按设置完成,再按开始计算 </ font ></ span >< font color ="#999999" > 。 </ font >< br >
</ td >
</ tr >
</ table >
< div align ="center" class ="nine-pt" ></ div >
</ BODY >
</ HTML >
< HEAD >
< TITLE > 女性安全期测试 </ TITLE >
< META HTTP-EQUIV ="Content-Type" CONTENT ="text/html; charset=gb2312" >
< style type ="text/css" >
<!--
a { text-decoration : none }
a:hover { text-decoration : underline ; color : #0000ff }
A:active { color : #FF0099 }
table { font-family : "宋体" ; font-size : 9pt }
.nine-pt { font-family : "宋体" ; font-size : 9pt }
.inputform { border : 1px double ; border-color : #000000 ; font-family : "宋体" ; font-size : 9pt }
.titletext { FONT-SIZE : 14.8px ; FONT-FAMILY : "宋体" ; LETTER-SPACING : 6px ; }
INPUT { background : #efefff ; BORDER-TOP-WIDTH : 1px ; PADDING-RIGHT : 1px ; PADDING-LEFT : 1px ; BORDER-LEFT-WIDTH : 1px ; FONT-SIZE : 9pt ; BORDER-LEFT-COLOR : #cccccc ; BORDER-BOTTOM-WIDTH : 1px ; BORDER-BOTTOM-COLOR : #cccccc ; PADDING-BOTTOM : 1px ; BORDER-TOP-COLOR : #cccccc ; PADDING-TOP : 1px ; HEIGHT : 18px ; BORDER-RIGHT-WIDTH : 1px ; BORDER-RIGHT-COLOR : #cccccc }
-->
</ style >
< script language ="JavaScript" >
<!-- Hide this script from old browsers --
if ( ! document.layers &&! document.all)
event = " test "
function showtip2(current,e,text,index){
if (document.all && document.readyState == " complete " ){
eval( " var tooltip=document.all.tooltip " + index + " ; " )
// tooltip.innerHTML='<marquee style="border:1px solid black">'+text+'</marquee>'
tooltip.innerHTML = '' + text + ' </ TABLE > '
tooltip.style.pixelLeft = event.x - 195
tooltip.style.pixelTop = event.y - 130
tooltip.style.visibility = " visible "
}
else if (document.layers){
eval( " var tooltip=document.tooltip " + index + " ; " )
eval( " var nstip=document.tooltip " + index + " .document.nstip " + index + " ; " )
nstip.document.write(' < b > ' + text + ' </ b > ')
nstip.document.close()
nstip.left = 0
// currentscroll=setInterval("scrolltip(" + index + ")",100)
tooltip.left = event.x - 195
tooltip.top = event.y - 130
tooltip.visibility = " show "
}
}
function hidetip2(index){
if (document.all)
eval( " document.all.tooltip " + index + " .style.visibility='hidden'; " );
else if (document.layers){
// clearInterval(currentscroll)
eval( " document.tooltip " + index + " .visibility='hidden'; " )
}
}
function scrolltip(index){
eval( " var nstip=document.tooltip " + index + " .document.nstip " + index + " ; " )
if (nstip.left >=- nstip.document.width)
nstip.left -= 5
else
nstip.left = 150
}
function montharr(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;
}
var CalendarOuterHTML = '';
var Today = new Date();
var DaysPerMonth = 0 ;
// Get the number of day in some month
function GetDayPerMonth(year,month)
{
var monthDays = new montharr( 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];
}
function GetCalendarOuterHTML(CalendarIndex,HaveLayer)
{
CalendarOuterHTML = '';
var thisYear = frmInput.txtYear.value;
var thisMonth = parseInt(frmInput.txtMonth.value) + CalendarIndex - 1 ;
// when thisMonth beyond 12
if (thisMonth > 12 )
{
thisYear = parseInt(thisYear) + 1 ;
thisMonth = thisMonth % 12 ;
}
// title of the calendar
CalendarOuterHTML = CalendarOuterHTML + " <table border=0 cellspacing=0 cellpadding=3 align=right id=Calendar " + CalendarIndex + " > " ;
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#84C1FF><TD colspan=7 class=nine-pt height=15 align=center> " ;
CalendarOuterHTML = CalendarOuterHTML + thisYear + ' 年 ';
CalendarOuterHTML = CalendarOuterHTML + thisMonth + ' 月';
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#CAE4FF><TD width=18 class=nine-pt>日<TD width=18 class=nine-pt>一<TD width=18 class=nine-pt>二<TD width=18 class=nine-pt>三<TD width=18 class=nine-pt>四<TD width=18 class=nine-pt>五<TD width=18 class=nine-pt>六 " ;
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#FFFFFF> " ;
// Get the day of the first Day
var firstDay = new Date(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value) - 2 + CalendarIndex), 1 ));
testMe = firstDay.getDate();
if (testMe == 2 )
firstDay.setDate( 0 );
startDay = firstDay.getDay();
// display empty cells before the first day of the month
column = 0 ;
for (i = 0 ; i < startDay; i ++ )
{
CalendarOuterHTML = CalendarOuterHTML + " <TD width=18 class=nine-pt> " ;
column ++ ;
}
// display the grids in the calendar
var Lastday = new Date(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 + " <TD width=18 class=nine-pt> " ;
var color = " blue " ; // default color without layer displayed
// Get layer HTML
if (HaveLayer)
{
var ThisDay = new Date(Date.UTC(thisYear,thisMonth - 1 ,i))
var msPerDay = 24 * 60 * 60 * 1000 ;
var mensesCyc = parseInt(frmInput.txtMinMensesCyc.value); // Min menses Cycle
var msDiff = ThisDay.getTime() - Lastday.getTime();
dayDiff = Math.floor(msDiff / msPerDay); // get the days between thisday and lastday
dayRemainder = (dayDiff % mensesCyc + mensesCyc) % mensesCyc;
// if (i<2) {alert(ThisDay.toLocaleString()); alert(Lastday.toLocaleString()); alert(dayDiff);alert(dayRemainder);}
var tooltips = "" ; // content of layer
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 ; // index of layer
tooltips = " <TABLE border=0 cellPadding=2 cellSpacing=1 width=100% align=center bgcolor=#008080> " +
" <TR><TD style=BACKGROUND-COLOR:white;COLOR: " + color + " ;FONT-FAMILY:宋体;FONT-SIZE:9pt;TEXT-DECORATION:none> " +
tooltips + " </TD></TR></TABLE> " ;
CalendarOuterHTML = CalendarOuterHTML + " <div id=\ " tooltip " + iLayerIndex + " \ " style=\ " position:absolute;visibility:hidden;clip:rect( 0 150 150 0 );width:150px;background - color:seashell\ " > " ;
CalendarOuterHTML = CalendarOuterHTML + " <layer name=\ " nstip " + iLayerIndex + " \ " width=\ " 1000px\ " bgColor=\ " seashell\ " height=\ " 500px\ " ></layer></div> " ;
CalendarOuterHTML = CalendarOuterHTML + " <a href=\ " #\ " onMouseOver=\ " showtip2( this ,event,' " + tooltips + " ', " + iLayerIndex + " )\ " onMouseOut=\ " hidetip2( " + iLayerIndex + " )\ " > " ;
}
CalendarOuterHTML = CalendarOuterHTML + " <FONT COLOR=\ "" + color + " \ " > " + i + " </FONT> " ;
column ++ ;
if (column == 7 )
{
CalendarOuterHTML = CalendarOuterHTML + " <TR bgcolor=#FFFFFF> " ;
column = 0 ;
}
}
// display empty cells after the final day of the month
var FinalDay = new Date(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 + " <TD width=18 class=nine-pt> " ;
}
CalendarOuterHTML = CalendarOuterHTML + " </TABLE> " ;
}
// to check input errors and display both calendars
function DisplayCalendar()
{
// check whether the date is legal
if (frmInput.txtYear.value < 1900 || isNaN(frmInput.txtYear.value))
{
alert( " 请输入合法年份! " )
frmInput.txtYear.focus();
return false ;
}
if (isNaN(frmInput.txtMonth.value) || frmInput.txtMonth.value < 1 || frmInput.txtMonth.value > 12 )
{
alert( " 请输入合法月份! " )
frmInput.txtMonth.focus();
return false ;
}
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();
return false ;
}
var Lastday = new Date(Date.UTC(frmInput.txtYear.value,(parseInt(frmInput.txtMonth.value) - 1 ),frmInput.txtDay.value))
if ((Today.getTime() - Lastday.getTime()) < 0 )
{
alert( " 请输入正确的上次月经时间(不能早于当前时间)! " )
frmInput.txtYear.focus();
return false ;
}
// check input
if (isNaN(frmInput.txtMinMensesCyc.value))
{
alert( " 请输入数字! " )
frmInput.txtMinMensesCyc.focus();
return false ;
}
if (parseInt(frmInput.txtMinMensesCyc.value) > 40 || parseInt(frmInput.txtMinMensesCyc.value) < 22 )
{
alert( " 您输入的最短月经周期与标准月经周期相差太大,程序无法测试,请仔细核对。\n\n如输入确无问题请咨询医生! " )
frmInput.txtMinMensesCyc.focus();
return false ;
}
if (isNaN(frmInput.txtMaxMensesCyc.value) || parseInt(frmInput.txtMaxMensesCyc.value) < parseInt(frmInput.txtMinMensesCyc.value))
{
alert( " 输入错误,请仔细核对您的输入周期! " );
frmInput.txtMaxMensesCyc.focus();
return false ;
}
// display calendars
GetCalendarOuterHTML( 1 , 1 );
document.all.Calendar1.outerHTML = CalendarOuterHTML;
GetCalendarOuterHTML( 2 , 1 );
document.all.Calendar2.outerHTML = CalendarOuterHTML;
MM_showHideLayers('Layer1','','show');
}
// Initialize
function InitialCalendar()
{
// Initialize the date input boxes
frmInput.txtYear.value = Today.getYear();
frmInput.txtMonth.value = Today.getMonth() + 1 ;
frmInput.txtDay.value = Today.getDate();
// Initialize the calendars
GetCalendarOuterHTML( 1 , 0 );
document.all.Calendar1.outerHTML = CalendarOuterHTML;
GetCalendarOuterHTML( 2 , 0 );
document.all.Calendar2.outerHTML = CalendarOuterHTML;
// Set focus
frmInput.btnCalculate.focus();
}
// -- End Hiding Here -->
</ script >
< script language ="JavaScript" >
<!--
<!--
function MM_reloadPage(init) { // reloads the window if Nav4 resized
if (init == true ) with (navigator) { if ((appName == " Netscape " ) && (parseInt(appVersion) == 4 )) {
document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage; }}
else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
}
MM_reloadPage( true );
// -->
function MM_findObj(n, d) { // v4.0
var p,i,x; if ( ! d) d = document; if ((p = n.indexOf( " ? " )) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1 )].document; n = n.substring( 0 ,p);}
if ( ! (x = d[n]) && d.all) x = d.all[n]; for (i = 0 ; ! x && i < d.forms.length;i ++ ) x = d.forms[i][n];
for (i = 0 ; ! x && d.layers && i < d.layers.length;i ++ ) x = MM_findObj(n,d.layers[i].document);
if ( ! x && document.getElementById) x = document.getElementById(n); return x;
}
function MM_showHideLayers() { // v3.0
var i,p,v,obj,args = MM_showHideLayers.arguments;
for (i = 0 ; i < (args.length - 2 ); i += 3 ) if ((obj = MM_findObj(args[i])) != null ) { v = args[i + 2 ];
if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible':(v = 'hide') ? 'hidden':v; }
obj.visibility = v; }
}
function MM_swapImgRestore() { // v3.0
var i,x,a = document.MM_sr; for (i = 0 ;a && i < a.length && (x = a[i]) && x.oSrc;i ++ ) x.src = x.oSrc;
}
function MM_preloadImages() { // v3.0
var d = document; if (d.images){ if ( ! d.MM_p) d.MM_p = new Array();
var i,j = d.MM_p.length,a = MM_preloadImages.arguments; for (i = 0 ; i < a.length; i ++ )
if (a[i].indexOf( " # " ) != 0 ){ d.MM_p[j] = new Image; d.MM_p[j ++ ].src = a[i];}}
}
function MM_swapImage() { // v3.0
var i,j = 0 ,x,a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0 ;i < (a.length - 2 );i += 3 )
if ((x = MM_findObj(a[i])) != null ){document.MM_sr[j ++ ] = x; if ( ! x.oSrc) x.oSrc = x.src; x.src = a[i + 2 ];}
}
// -->
</ script >
</ HEAD >
< BODY BGCOLOR =#FFFFFF onload ="javascript:InitialCalendar();MM_preloadImages('img/close_o.gif')" >
< script language ="JavaScript" >
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false ;
return false ;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3 )
return false ;
}
else
if (event.button == 2 || event.button == 3 )
{
event.cancelBubble = true
event.returnValue = false ;
return false ;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
// -->
</ script >
< div id ="Layer1" style ="position:absolute; left:205px; top:155px; width:337px; height:307px; z-index:2; visibility: hidden" >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="3" align ="center" height ="250" bgcolor ="#FFCCFF" >
< tr >
< td bgcolor ="#FFCCFF" align ="center" class ="titletext" >
< table width ="100%" border ="0" cellspacing ="0" cellpadding ="0" >
< tr >
< td width ="95%" class ="titletext" align ="center" > 结果显示 </ td >
< td width ="5%" >< a href ="#" onMouseOut ="MM_swapImgRestore()" onMouseOver ="MM_swapImage('Image1','','img/close_o.gif',1)" >< img name ="Image1" border ="0" src ="img/close_d.gif" width ="11" height ="11" onClick ="MM_showHideLayers('Layer1','','hide')" ></ a ></ td >
</ tr >
</ table >
</ td >
</ tr >
< tr >
< td bgcolor ="#EEF7FF" align ="center" >
< table width ="360" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr valign ="top" >
< td height ="66" class ="nine-pt" width ="169" valign ="top" >
< table border ="0" cellspacing ="0" cellpadding ="3" id =Calendar1 >
</ table >
</ td >
< td height ="66" class ="nine-pt" width ="191" valign ="top" >
< table border ="0" cellspacing ="0" cellpadding ="3" align ="right" id =Calendar2 >
</ table >
</ td >
</ tr >
</ table >< br >
< table width ="256" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr class ="nine-pt" >
< td width ="89" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#009933" width ="30" > </ td >
< td width ="47" > 安全期 </ td >
</ tr >
</ table >
</ td >
< td width ="85" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#FF3300" width ="30" > </ td >
< td width ="47" > 危险期 </ td >
</ tr >
</ table >
</ td >
< td width ="82" height ="2" >
< table width ="77" border ="0" cellspacing ="0" cellpadding ="0" >
< tr class ="nine-pt" >
< td bgcolor ="#FFCC00" width ="30" > </ td >
< td width ="47" > 月经期 </ td >
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ td >
</ tr >
</ table >
</ div >
< table border ="1" cellspacing ="0" cellpadding ="2" align ="center" bordercolor ="#666699" >
< tr >
< td bordercolor ="#FFFFFF" align ="center" class ="titletext" bgcolor ="#EEF7FF" >< font color ="#0066CC" > 女性安全期测试 </ font ></ td >
</ tr >
< tr >
< td bordercolor ="#FFFFFF" align ="center" >
< form method ="post" action ="#" name =frmInput onsubmit ="javascript:DisplayCalendar();" >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="2" bordercolorlight ="#666666" align ="center" bordercolordark ="#FFFFFF" bordercolor ="#000000" >
< tr bgcolor ="#D2E9FF" >
< td rowspan ="2" class ="nine-pt" height ="14" width ="80" align ="center" >
月经周期设置 </ td >
< td class ="nine-pt" height ="12" colspan ="3" width ="266" > 最短月经周期
< input type ="text" name ="txtMinMensesCyc" size ="2" maxlength =2 class ="inputform" value ="28" >
天 </ td >
</ tr >
< tr bgcolor ="C6EB4C" >
< td colspan ="3" class ="nine-pt" height ="2" width ="266" bgcolor ="#D2E9FF" > 最长月经周期
< input type ="text" name ="txtMaxMensesCyc" size ="2" maxlength =2 class ="inputform" value ="28" >
天 </ td >
</ tr >
</ table >
< table width ="360" border ="0" cellspacing ="1" cellpadding ="2" bordercolorlight ="#666666" align ="center" bordercolordark ="#FFFFFF" bordercolor ="#000000" >
< tr bgcolor ="#D2E9FF" >
< td width ="80" class ="nine-pt" height ="2" align ="center" bgcolor ="#D2E9FF" > 上次月经时间 </ td >
< td colspan ="3" class ="nine-pt" height ="2" width ="266" bgcolor ="#D2E9FF" >
< input type ="text" name ="txtYear" size ="4" maxlength =4 class ="inputform" >
年
< input type ="text" name ="txtMonth" size ="2" maxlength =2 class ="inputform" >
月
< input type ="text" name ="txtDay" size ="2" maxlength =2 class ="inputform" >
日 </ td >
</ tr >
</ table >
< table width ="359" border ="0" cellspacing ="0" cellpadding ="0" align ="center" >
< tr >
< td height ="38" bgcolor ="#D2E9FF" >
< div align ="center" >
< input type ="button" name ="Submit3" value ="设置完成" class ="nine-pt" onClick ="javascript:DisplayCalendar();" >
< input type ="button" name ="btnCalculate" value ="开始计算" class ="nine-pt" onClick ="javascript:DisplayCalendar();" >
< input type ="reset" name ="reset" value ="重新输入" class ="nine-pt" >
</ div >
</ td >
</ tr >
</ table >
</ form >
< span class ="nine-pt" >< font color ="#999999" > 帮助:请先设置好周期后和时间后,按设置完成,再按开始计算 </ font ></ span >< font color ="#999999" > 。 </ font >< br >
</ td >
</ tr >
</ table >
< div align ="center" class ="nine-pt" ></ div >
</ BODY >
</ HTML >