Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
Line 80: Line 80:
}
}
-
function trimContents(ans, title)
+
function oldtrimContents(ans, title)
{
{
ans=ans.replace("<h3></h3>","");
ans=ans.replace("<h3></h3>","");
Line 89: Line 89:
return ans.substr(titlepos+title.length,endpos-titlepos);
return ans.substr(titlepos+title.length,endpos-titlepos);
 +
}
 +
 +
function trimContents(ans, title)
 +
{
 +
title=removeHTMLTags(title);
 +
//ans=ans.replace("<h3></h3>","");
 +
h3=new Regexp("/<(h3).*>(.*)<\/\1>/");
 +
var titlepos=ans.search(h3);
 +
if (titlepos<0) return 'Titles not found";
 +
var endpos=ans.indexOf(h3,titlepos+1);
 +
if (endpos<0) return ans.substr(titlepos,ans.length-titlepos);
 +
 +
return ans.substr(titlepos,endpos-titlepos);
 +
}
}

Revision as of 23:13, 25 October 2008

Gallery Bricks Notebook Team Project Home