Team:Uppsala/notebook
From 2013.igem.org
(Difference between revisions)
Line 9: | Line 9: | ||
<link rel="stylesheet" href="https://2013.igem.org/Template:Team:Uppsala/styles ?action=raw&ctype=text/css" type="text/css" /> | <link rel="stylesheet" href="https://2013.igem.org/Template:Team:Uppsala/styles ?action=raw&ctype=text/css" type="text/css" /> | ||
<script type="text/javascript" src="script/countdown.js"></script> | <script type="text/javascript" src="script/countdown.js"></script> | ||
- | <script type=" | + | <script> |
+ | |||
+ | function myFunction() | ||
+ | { | ||
+ | alert("I am an alert box!"); | ||
+ | } | ||
+ | |||
+ | function setStyle(id,style,value) | ||
+ | { | ||
+ | id.style[style] = value; | ||
+ | } | ||
+ | function opacity(el,opacity) | ||
+ | { | ||
+ | setStyle(el,"filter:","alpha(opacity="+opacity+")"); | ||
+ | setStyle(el,"-moz-opacity",opacity/100); | ||
+ | setStyle(el,"-khtml-opacity",opacity/100); | ||
+ | setStyle(el,"opacity",opacity/100); | ||
+ | } | ||
+ | |||
+ | Date.prototype.getWeek = function() | ||
+ | { | ||
+ | var onejan = new Date(this.getFullYear(),0,1); | ||
+ | return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7); | ||
+ | |||
+ | } | ||
+ | |||
+ | function calendar_normal(year, month) | ||
+ | { | ||
+ | var date = new Date(); | ||
+ | var day = date.getDate(); | ||
+ | //var month = date.getMonth(); | ||
+ | //var year = date.getYear(); | ||
+ | var date = new Date(year, month, day); | ||
+ | if(year<=200) | ||
+ | { | ||
+ | year += 1900; | ||
+ | } | ||
+ | months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); | ||
+ | days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31); | ||
+ | if(year%4 == 0 && year!=1900) | ||
+ | { | ||
+ | days_in_month[1]=29; | ||
+ | } | ||
+ | total = days_in_month[month]; | ||
+ | var date_today = months[month]+' '+year; | ||
+ | beg_j = date; | ||
+ | beg_j.setDate(2); | ||
+ | if(beg_j.getDate()==3) | ||
+ | { | ||
+ | beg_j=setDate(0); | ||
+ | } | ||
+ | beg_j = beg_j.getDay(); | ||
+ | document.write('<table class="cal_calendar" onload="opacity(document.getElementById(\'cal_body\'),20);"><tbody id="cal_body"><tr class="head"><th class="arrow"><input type="submit" onclick="calendar_normal(year, left_arrow(month))" value="<-"></th><th colspan="6" >'+date_today+'</th><th class="arrow"><input type="submit" onclick="myFunction()" value="->"></th></tr>'); | ||
+ | document.write('<tr class="cal_d_weeks"><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th><th>Sun</th><th>Week</th></tr><tr>'); | ||
+ | week = 0; | ||
+ | for(i=1;i<=beg_j;i++) | ||
+ | { | ||
+ | document.write('<td class="cal_days_bef_aft">'+(days_in_month[month-1]-beg_j+i)+'</td>'); | ||
+ | week++; | ||
+ | } | ||
+ | for(i=1;i<=total;i++) | ||
+ | { | ||
+ | if(week==0) | ||
+ | { | ||
+ | document.write('<tr>'); | ||
+ | } | ||
+ | if(day==i) | ||
+ | { | ||
+ | document.write('<td class="cal_today"><input type="submit" onclick="myFunction()" value="'+i+'"></td>'); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | document.write('<td class="not_today"><input type="submit" onclick="myFunction()" value="'+i+'"></td>'); | ||
+ | } | ||
+ | week++; | ||
+ | if(week==7) | ||
+ | { | ||
+ | var weeknr = new Date(date.getYear(), date.getMonth(), i).getWeek(); | ||
+ | document.write('<td class="week"><input type="submit" onclick="myFunction()" value="'+weeknr+'"></td>'); | ||
+ | document.write('</tr>'); | ||
+ | week=0; | ||
+ | } | ||
+ | } | ||
+ | for(i=1;week!=0;i++) | ||
+ | { | ||
+ | document.write('<td class="cal_days_bef_aft">'+i+'</td>'); | ||
+ | week++; | ||
+ | if(week==7) | ||
+ | { | ||
+ | if(weeknr == 51) | ||
+ | { | ||
+ | var weeknr = 1; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | var weeknr = weeknr+1; | ||
+ | } | ||
+ | document.write('<td class="week"><input type="submit" onclick="myFunction()" value="'+weeknr+'"></td>'); | ||
+ | document.write('</tr>'); | ||
+ | week=0; | ||
+ | } | ||
+ | } | ||
+ | document.write('</tbody></table>'); | ||
+ | opacity(document.getElementById('cal_body'),70); | ||
+ | return true; | ||
+ | } | ||
+ | function left_arrow(m){ | ||
+ | return m--; | ||
+ | } | ||
+ | function rigth_arrow(m){ | ||
+ | return m++; | ||
+ | } | ||
+ | //document.getElementById("calendar").innerHTML = | ||
+ | |||
+ | </script> | ||
</head> | </head> | ||
Revision as of 12:32, 23 July 2013