Template:WarNotebook

From 2008.igem.org

(Difference between revisions)
Line 90: Line 90:
document.getElementById("back").href=adresbase+prevday(tokeny[tokeny.length-1].replace('/ /g','_'));
document.getElementById("back").href=adresbase+prevday(tokeny[tokeny.length-1].replace('/ /g','_'));
-
function getFile(url) {
+
 
-
  if (window.XMLHttpRequest) {             
+
-
    AJAX=new XMLHttpRequest();             
+
-
  } else {                                 
+
-
    AJAX=new ActiveXObject("Microsoft.XMLHTTP");
+
-
  }
+
-
  if (AJAX) {
+
-
    AJAX.open("GET", url, false);                           
+
-
    AJAX.send(null);
+
-
    return AJAX.responseText;                                       
+
-
  } else {
+
-
    return false;
+
-
  }                                           
+
-
}
+
function ajaxsearch(url,phrase)
function ajaxsearch(url,phrase)
{
{
-
var fil=getFile(url);
+
if (window.XMLHttpRequest) { // Mozilla, Safari, Opera ...
-
if (!fil) return false;
+
  var req = new XMLHttpRequest();
 +
} else if (window.ActiveXObject) { // IE
 +
  var req = new ActiveXObject("Microsoft.XMLHTTP");
 +
}
 +
var ans;
 +
req.overrideMimeType('text/xml');
 +
req.onreadystatechange = function() { //początek wewnętrznej funkcji
 +
if (http_request.readyState == 4) {
 +
            if (http_request.status == 200) {
 +
                ans=req.responseText;
 +
alert(ans.search(phrase));
 +
            }
 +
}
 +
 
 +
}; //koniec wewnętrznej funkcji
 +
 
 +
req.open('GET', url, true);
 +
req.send(null);
-
var result=fil.search(phrase);
 
-
//if (result>0) return true;
 
-
//else return false;
 
-
return result;
 
}
}
Line 120: Line 120:
var phr="onstuct";
var phr="onstuct";
phr=phr.replace("on","con");
phr=phr.replace("on","con");
-
alert(ajaxsearch("https://2008.igem.org/Team:Warsaw/Calendar-Main/6_June_2008",phr));
+
ajaxsearch("https://2008.igem.org/Team:Warsaw/Calendar-Main/6_June_2008",phr);
/* ]]> */</script>
/* ]]> */</script>
<br/>
<br/>
</html>
</html>

Revision as of 17:42, 9 October 2008

Gallery Bricks Notebook Team Project Home


Previous day