Team:Warsaw/JSTest

From 2008.igem.org

(Difference between revisions)
Line 96: Line 96:
//ans=ans.replace("<h3></h3>","");
//ans=ans.replace("<h3></h3>","");
h3=new Regexp("/<(h3).*>(.*)<\/\1>/");
h3=new Regexp("/<(h3).*>(.*)<\/\1>/");
-
var titlepos=ans.search(h3);
+
var titlepos=0;
 +
do
 +
{
 +
titlepos=ans.indexOf(h3,titlepos);
 +
 
if (titlepos<0) return "Titles not found";
if (titlepos<0) return "Titles not found";
 +
var endpos=ans.indexOf(h3,titlepos+1);
var endpos=ans.indexOf(h3,titlepos+1);
-
if (endpos<0) return ans.substr(titlepos,ans.length-titlepos);
+
var curtitle=removeHTMLTags(ans.match(h3,titlepos));
 +
if (curtitle==title) {
 +
if (endpos<0) return ans.substr(titlepos,ans.length-titlepos);
return ans.substr(titlepos,endpos-titlepos);
return ans.substr(titlepos,endpos-titlepos);
 +
}
 +
 +
}
 +
while (titlepos>=0);
 +
return "Search Error";
}
}

Revision as of 23:20, 25 October 2008

Gallery Bricks Notebook Team Project Home