Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
Line 70: Line 70:
                 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=trimContents(ans,title);
+
                 document.getElementById(day).innerHTML=trimStr(trimContents(ans,title));
             }
             }
}  
}  
Line 78: Line 78:
req.open('GET', adresbase+day, true);
req.open('GET', adresbase+day, true);
req.send(null);
req.send(null);
-
}
 
-
 
-
function oldtrimContents(ans, title)
 
-
{
 
-
ans=ans.replace("<h3></h3>","");
 
-
var titlepos=ans.search(title);
 
-
if (titlepos<0) return "'"+title+"' not found";
 
-
var endpos=ans.indexOf("<h3>",titlepos);
 
-
if (endpos<0) return ans.substr(titlepos+title.length,ans.length-titlepos);
 
-
 
-
return ans.substr(titlepos+title.length,endpos-titlepos);
 
}
}
function trimStr(str)
function trimStr(str)
{
{
-
 
return str.replace(/^\s+|\s+$/g, '');
return str.replace(/^\s+|\s+$/g, '');
}
}

Revision as of 17:39, 26 October 2008

Gallery Bricks Notebook Team Project Home