Team:Warsaw/Calendar-Main/EmptyDays
From 2008.igem.org
(Difference between revisions)
(2 intermediate revisions not shown) | |||
Line 2: | Line 2: | ||
<html> | <html> | ||
<h1>Empty entries locator</h1> | <h1>Empty entries locator</h1> | ||
+ | <form name="params" action="JavaScript:find_empty()"> | ||
+ | <table class="month" width="100%"> | ||
+ | |||
+ | <tr><td width="50%">Start date</td><td>End date</td></tr> | ||
+ | <tr><td width="50%"> | ||
+ | <input type="text" value="1" size=1 name="start_day"> | ||
+ | <select name="start_month"> | ||
+ | <option value="January">January</option> | ||
+ | <option value="February">February</option> | ||
+ | <option value="March">March</option> | ||
+ | <option value="April">April</option> | ||
+ | <option value="May" selected="selected">May</option> | ||
+ | <option value="June">June</option> | ||
+ | <option value="July">July</option> | ||
+ | <option value="August">August</option> | ||
+ | <option value="September">September</option> | ||
+ | <option value="October">October</option> | ||
+ | <option value="November">November</option> | ||
+ | <option value="December">December</option> | ||
+ | </select> | ||
+ | <input type="text" value="2008" size=3 name="start_year" disabled="disabled"> | ||
+ | </td> | ||
+ | <td> | ||
+ | <input type="text" value="1" size=1 name="end_day"> | ||
+ | <select name="end_month"> | ||
+ | <option value="January">January</option> | ||
+ | <option value="February">February</option> | ||
+ | <option value="March">March</option> | ||
+ | <option value="April">April</option> | ||
+ | <option value="May">May</option> | ||
+ | <option value="June" selected="selected">June</option> | ||
+ | <option value="July">July</option> | ||
+ | <option value="August">August</option> | ||
+ | <option value="September">September</option> | ||
+ | <option value="October">October</option> | ||
+ | <option value="November">November</option> | ||
+ | <option value="December">December</option> | ||
+ | </select> | ||
+ | <input type="text" value="2008" size=3 name="end_year" disabled="disabled"> | ||
+ | </td></tr></table> | ||
+ | <input type="submit" value="Go!"> | ||
+ | </form> | ||
+ | |||
<h4 id="progress"></h4> | <h4 id="progress"></h4> | ||
<ul id="results"></ul> | <ul id="results"></ul> | ||
Line 72: | Line 115: | ||
eday=eday.replace("y","yday"); | eday=eday.replace("y","yday"); | ||
- | function next_empty(day) | + | function next_empty(day,end_day) |
{ | { | ||
Line 85: | Line 128: | ||
} | } | ||
var ans; | var ans; | ||
- | req.overrideMimeType('text/xml'); | + | if (window.overrideMimeType) req.overrideMimeType('text/xml'); |
req.onreadystatechange = function() { //początek wewnętrznej funkcji | req.onreadystatechange = function() { //początek wewnętrznej funkcji | ||
if (req.readyState == 4) { | if (req.readyState == 4) { | ||
Line 91: | Line 134: | ||
ans=req.responseText; | ans=req.responseText; | ||
if(ans.search(eday)>0) document.getElementById("results").innerHTML=document.getElementById("results").innerHTML+'<li><a href="'+adresbase+nday+'">'+nday+"</a></li>"; | if(ans.search(eday)>0) document.getElementById("results").innerHTML=document.getElementById("results").innerHTML+'<li><a href="'+adresbase+nday+'">'+nday+"</a></li>"; | ||
- | + | if (day==end_day) { | |
- | next_empty(nday); | + | document.getElementById("progress").innerHTML="Done"; |
+ | return true; | ||
+ | } | ||
+ | else { next_empty(nday,end_day); } | ||
} | } | ||
Line 103: | Line 149: | ||
} | } | ||
- | + | function find_empty() | |
+ | { | ||
+ | var start_day=parseInt(document.params.start_day.value); | ||
+ | var start_month=document.params.start_month.value; | ||
+ | var start_year=parseInt(document.params.start_year.value); | ||
+ | var end_day=parseInt(document.params.end_day.value); | ||
+ | var end_month=document.params.end_month.value; | ||
+ | var end_year=parseInt(document.params.end_year.value); | ||
+ | |||
+ | if (start_day>0) if (start_day<32) var start_date=start_day+'_'+start_month+'_'+start_year; | ||
+ | else | ||
+ | { | ||
+ | document.getElementById("progress").innerHTML="Start day error" | ||
+ | return; | ||
+ | } | ||
+ | if (end_day>0) if (end_day<32) var end_date=end_day+'_'+end_month+'_'+end_year; | ||
+ | else | ||
+ | { | ||
+ | document.getElementById("progress").innerHTML="End day error" | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | if (start_month==end_month) if(end_day<start_day) | ||
+ | { | ||
+ | document.getElementById("progress").innerHTML="Wrong date range" | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | //document.getElementById("progress").innerHTML="Start: "+start_date+"<br/>End: "+end_date; | ||
+ | next_empty(start_date,end_date); | ||
+ | } | ||
+ | |||
+ | // | ||
+ | |||
+ | |||
/* ]]> */</script> | /* ]]> */</script> |
Latest revision as of 17:43, 10 October 2008
Empty entries locator
|