Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
Line 99: Line 99:
function trimContents(ans, title)
function trimContents(ans, title)
{
{
-
//title=removeHTMLTags(title);
 
-
//ans=ans.replace("<h3></h3>","");
 
h3=new RegExp(/<(h3).*>(.*)<\/\1>/i);
h3=new RegExp(/<(h3).*>(.*)<\/\1>/i);
-
//alert(ans.split(/<h3>/i));
+
 
-
var front=ans.split(/<h3>/i);
+
var titles=ans.match(h3);
-
for (var i=0;i<front.length;i++)
+
 
 +
for (var i=0;i<titles.length;i++)
{
{
-
var end=front[i].split(/<\/h3>/i);
+
if (removeHTMLTags(trimStr(titles[i]))==removeHTMLTags(trimStr(title))) return titles[i+1];
-
for (var j=0;j<end.length;j++) if (removeHTMLTags(trimStr(end[i]))==removeHTMLTags(trimStr(title))) return end[i+1];
+
}
 +
 
 +
var topics=ans.split(h3);
 +
for (var i=0;i<topics.length;i++)
 +
{
 +
if (removeHTMLTags(trimStr(topics[i]))==removeHTMLTags(trimStr(title))) return topics[i+1];
}
}

Revision as of 00:45, 26 October 2008

Gallery Bricks Notebook Team Project Home