Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
Line 69: Line 69:
                 ans=req.responseText;
                 ans=req.responseText;
                 ans=ans.substr(ans.search("<start>"),ans.search("<end>")-ans.search("<start>"));
                 ans=ans.substr(ans.search("<start>"),ans.search("<end>")-ans.search("<start>"));
-
                 document.getElementById(day).innerHTML=ans;
+
                 document.getElementById(day).innerHTML=trimContents(ans);
             }
             }
}  
}  
Line 79: Line 79:
}
}
 +
function trimContents(ans, title)
 +
{
 +
var titlepos=ans.search(title);
 +
if (titlepos<0) return ans;
 +
var endpos=ans.search("<h3>",titlepos);
 +
if (endpos<0) return ans.substr(titlepos,ans.length-titlepos);
-
 
+
return ans.substr(titlepos,endpos-titlepos);
 +
}
var qs=new Querystring();
var qs=new Querystring();
var num=parseInt(qs.get("num", "0"));
var num=parseInt(qs.get("num", "0"));

Revision as of 21:13, 25 October 2008

Gallery Bricks Notebook Team Project Home