Team:Warsaw/JSTest
From 2008.igem.org
(Difference between revisions)
Line 2: | Line 2: | ||
<html> | <html> | ||
- | |||
<div id="progress"></div> | <div id="progress"></div> | ||
- | <div id=" | + | <div id="html"></div> |
+ | |||
<script src=http://adamv.com/dev/javascript/files/querystring.js"></script> | <script src=http://adamv.com/dev/javascript/files/querystring.js"></script> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
Line 32: | Line 32: | ||
} | } | ||
+ | |||
+ | var months=['January','February','March','April','May','June','July','August','September','October','November','December']; | ||
+ | |||
+ | var adresbase='https://2008.igem.org/Team:Warsaw/Calendar-Main/'; | ||
+ | |||
+ | function merge(days) | ||
+ | { | ||
+ | for (var i=0;i<merge.length;i++) | ||
+ | { | ||
+ | var div=document.createElement("div"); | ||
+ | var h=document.createElement("h1"); | ||
+ | h.innerHTML=days[i]; | ||
+ | div.setAttribute("name",days[i]); | ||
+ | document.GetElementById("html").appendChild(h); | ||
+ | document.GetElementById("html").appendChild(div); | ||
+ | fill(days[i]); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | function fill(day) | ||
+ | { | ||
+ | if (window.XMLHttpRequest) { // Mozilla, Safari, Opera ... | ||
+ | var req = new XMLHttpRequest(); | ||
+ | } else if (window.ActiveXObject) { // IE | ||
+ | var req = new ActiveXObject("Microsoft.XMLHTTP"); | ||
+ | } | ||
+ | var ans; | ||
+ | if (window.overrideMimeType) req.overrideMimeType('text/xml'); | ||
+ | req.onreadystatechange = function() { //początek wewnętrznej funkcji | ||
+ | if (req.readyState == 4) { | ||
+ | if (req.status == 200) { | ||
+ | ans=req.responseText; | ||
+ | document.getElementById(day).innerHTML=ans; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | }; //koniec wewnętrznej funkcji | ||
+ | |||
+ | req.open('GET', adresbase+day, true); | ||
+ | req.send(null); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
var qs=new Querystring(); | var qs=new Querystring(); | ||
var num=parseInt(qs.get("num", "0")); | var num=parseInt(qs.get("num", "0")); | ||
+ | var days=new Array(num); | ||
for (var i=0;i<num;i++) | for (var i=0;i<num;i++) | ||
{ | { | ||
- | + | days[i]=qs.get("arg"+i); | |
} | } | ||
+ | |||
+ | if (days.length>0) merge(days); | ||
+ | |||
+ | |||
/* ]]> */</script> | /* ]]> */</script> | ||
Revision as of 20:18, 25 October 2008
|