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=0;
 
-
do
 
-
{
 
-
titlepos=ans.indexOf(h3,titlepos);
 
-
if (titlepos<0) return "Titles not found";
+
var topics=ans.split(h3);
-
var endpos=ans.indexOf(h3,titlepos+1);
+
for (var i=0;i<topics.length;i++)return topics[i];
-
var curtitle=ans.match(h3,titlepos);
 
-
 
-
if (curtitle==title) {
 
-
if (endpos<0) return ans.substr(titlepos,ans.length-titlepos);
 
-
return ans.substr(titlepos,endpos-titlepos);
 
-
}
 
-
 
-
}
 
-
while (titlepos>=0);
 
return "Search Error";
return "Search Error";

Revision as of 23:47, 25 October 2008

Gallery Bricks Notebook Team Project Home