Talk:ANAT2341 Embryology 2009: Difference between revisions

From Embryology
No edit summary
No edit summary
Line 1: Line 1:
<nowiki><script type="text/javascript" language="JavaScript">
<script type="text/javascript" language="JavaScript">


var maxday=new Array(12)
var maxday=new Array(12)
Line 75: Line 75:
<input type="button" value="Calculate" onclick="calc(this.form);return true;" style="background-color:#ddddff"><input type="reset" value="Reset" style="background-color:#ddddff"><br> <br>  
<input type="button" value="Calculate" onclick="calc(this.form);return true;" style="background-color:#ddddff"><input type="reset" value="Reset" style="background-color:#ddddff"><br> <br>  
<p>Your approximate birth (due) date is:<br> <input type="text" size="18" name="due"></form>
<p>Your approximate birth (due) date is:<br> <input type="text" size="18" name="due"></form>
</center></nowiki>
</center>

Revision as of 15:01, 24 February 2010

<script type="text/javascript" language="JavaScript">

var maxday=new Array(12) maxday[1]=31 maxday[2]=28 maxday[3]=31 maxday[4]=30 maxday[5]=31 maxday[6]=30 maxday[7]=31 maxday[8]=31 maxday[9]=30 maxday[10]=31 maxday[11]=30 maxday[12]=31

var monthname=new Array(12) monthname[1]="January" monthname[2]="February" monthname[3]="March" monthname[4]="April" monthname[5]="May" monthname[6]="June" monthname[7]="July" monthname[8]="August" monthname[9]="September" monthname[10]="October" monthname[11]="November" monthname[12]="December"

function calc(form){ var newmonth,newday,newyear day=form.Day.value year=form.Year.value month=form.Month.value newday=eval(day)+7 newmonth=eval(month)-3 newyear=eval(year) var max=maxday[month] if(month==2&&(year%4==0)){max=29}if(day>max){datestring="Wrong date, please correct and recalculate"}else{if(newday>max) {newday=newday-max newmonth=newmonth+1} if(newmonth<1){newmonth=newmonth+12}else{if(newmonth>12){newmonth=newmonth-12}newyear=newyear+1}var max=maxday[newmonth] if(newday>max){newday=newday-max newmonth=newmonth+1} var datestring=monthname[newmonth]+" "+newday+", "+newyear } form.due.value=datestring }

function today_click() {

  var theForm = document.info;
  var nowDate = new Date();
  theForm.Day.options[nowDate.getDate() - 1].selected = true;
  theForm.Month.options[nowDate.getMonth()].selected = true;
  theForm.Year.options[nowDate.getFullYear()- 2005].selected = true;

}

</script>


<noscript>NOTE: You need Javascript to use the calculator, which your browser has apparently disabled.</noscript>
<form name="info">

When did your last period begin?

<select name="Month" size="1"> <option selected value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select><select name="Day" size="1"> <option selected value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select><select name="Year" size="1"> <option value="2005">2005</option> <option selected value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> </select>

<input type="button" value="Insert today's date" onclick="today_click()" style="background-color:#ddddff"> <input type="button" value="Calculate" onclick="calc(this.form);return true;" style="background-color:#ddddff"><input type="reset" value="Reset" style="background-color:#ddddff">

Your approximate birth (due) date is:
<input type="text" size="18" name="due"></form>