Team:Amsterdam/Sandbox

From 2011.igem.org

(Difference between revisions)
Line 1: Line 1:
{{:Team:Amsterdam/Header}}
{{:Team:Amsterdam/Header}}
<html>
<html>
 +
<script type="text/javascript">
 +
//Configure the script here
 +
var teamname = "Amsterdam";
-
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
+
// Do not edit below
-
<script type="text/javascript">
+
// Loop through the URL
 +
function buildDepth(array,count) {
 +
var depthStr="";
 +
for (i=0;i<count;i++)
 +
{
 +
depthStr=depthStr + array[i] + "/" ;
 +
}
 +
return depthStr;
 +
}
-
var error=new Array("Saab","Volvo","BMW");
+
// The function
 +
function buildBreadCrumbTrail(page) {
 +
// Declare vars
 +
var constituentFolders = new Array();
 +
var currentURL = page;
-
for(var i=0; i<=(error.length - 1); i++) {
+
// Split the URL
 +
constituentFolders=currentURL.split("/");
-
    if (i==0){
+
// Start with a link to the team home page
-
       
+
var outputStr="<a href='https://2010.igem.org/Team:'" + teamname + ">Home</a>";
-
    var result = error[i]+ "<br />";
+
 
-
    } else {
+
// Loop through the URL
-
      var result = error[i]+ "<br />" + result;
+
for (count=0;count<(constituentFolders.length);count++)
-
    }
+
{
 +
outputStr=outputStr + " > <a href='https://2010.igem.org/Team:" + teamname +
 +
buildDepth(constituentFolders,count) + constituentFolders[count] + "'>" +
 +
capitaliseFirstLetter(constituentFolders[count]).replace(/-/gi," ") + "</a>";
 +
}
 +
 
 +
// Write to the div
 +
$("#breadcrumbs").html(outputStr);
 +
var txt=document.getElementById("myDiv")
 +
txt.innerHTML=outputStr;
}
}
-
function fillIt() {
+
// Capitalize the first letter
-
       
+
function capitaliseFirstLetter(string) {
-
     $("#array").html(result);
+
     return string.charAt(0).toUpperCase() + string.slice(1);
}
}
 +
// Start the script upon page load
 +
$(function() {
 +
buildBreadCrumbTrail(window.location.pathname);
 +
}
</script>
</script>
-
 
+
<div id="breadcrumbs">The breadcrumbs will show up in this div</div>
-
</head>
+
</html>
-
<body>
+
-
<input type="submit" onclick="fillIt()" value="Add to div"></input>
+
-
<div id="array"></div>
+
-
</html
+
{{:Team:Amsterdam/Footer}}
{{:Team:Amsterdam/Footer}}

Revision as of 15:07, 9 September 2011