Team:Uppsala/Templates/TselectTier3

From 2014.igem.org

(Difference between revisions)
(Created page with "<html> <div id="tab_selector"> <ul id="tabs"> <li><a href="#" title="tab1">One</a></li> <li><a href="#" title="tab2">...")
Line 3: Line 3:
                   <ul id="tabs">
                   <ul id="tabs">
-
                    <li><a href="#" title="tab1">One</a></li>
+
 
-
                    <li><a href="#" title="tab2">Two</a></li>
+
-
                    <li><a href="#" title="tab3">Three</a></li>
+
-
                    <li><a href="#" title="tab4">Four</a></li>
+
                   </ul>
                   </ul>
Line 13: Line 10:
           <div id="section_selector">
           <div id="section_selector">
-
          <div id="tab1">One - content</div>
 
-
    <div id="tab2">Two - content</div>
 
-
    <div id="tab3">Three - content</div>
 
-
    <div id="tab4">Four - content</div>
 
Line 22: Line 15:
<script>
<script>
-
 
+
var data = window.location.href;
 +
var List = document.getElementById("tabs");
 +
if (data.search("Team") !== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "/Team";
 +
createA("Team1", "#");
 +
createA("Team2", "#");
 +
createA("Team3", "#");
 +
}
 +
else if (data.search("Project") !== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Project";
 +
createA("Adhesion", "#", "tab1");
 +
createA("Killling", "#", "tab2");
 +
createA("Sensing", "#", "tab3");
 +
createA("Targeting", "#", "tab4");
 +
changeContent("hejsan svejsan", "tab1");
 +
changeContent("hejsan svejsan2", "tab2");
 +
changeContent("hejsan svejsan3", "tab3");
 +
changeContent("hejsan svejsan4", "tab4");
 +
}
 +
else if (data.search("Modeling")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Modeling";
 +
createA("Simulation", "#");
 +
createA("Matlab", "#");
 +
}
 +
else if (data.search("Parts")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Parts";
 +
createA("Colicin", "#");
 +
createA("YenR", "#");
 +
createA("USP45", "#");
 +
}
 +
else if (data.search("Human")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Human Practice";
 +
createA("Overview", "#");
 +
createA("Outreach", "#");
 +
createA("Continuity", "#");
 +
}
 +
else if (data.search("Notebook")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Notebook";
 +
createA("Protocols", "#");
 +
createA("Experiments", "#");
 +
createA("Results", "#");
 +
}
 +
else if (data.search("Safety")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Safety";
 +
createA("Safety", "#");
 +
createA("More safety", "#");
 +
createA("Max safety", "#");
 +
}
 +
else if (data.search("Attributions")!== -1)
 +
{
 +
document.getElementById("currentH").innerHTML = "Attributions";
 +
createA("Attributions 1", "#");
 +
createA("Attributions 2", "#");
 +
createA("Attributions 2", "#");
 +
}
 +
else
 +
{
 +
alert("Sorry something failed");
 +
}
 +
 +
 +
function createA(text, link, title) {
 +
var node = document.createElement("li");
 +
var a = document.createElement('a');
 +
var linkText = document.createTextNode(text);
 +
a.appendChild(linkText);
 +
a.href = link;
 +
a.title = title
 +
node.appendChild(a);
 +
document.getElementById("tabs").appendChild(node);
 +
}
 +
 +
function changeContent(text,id) {
 +
var node = document.createElement("div");
 +
node.id = id;
 +
var linkText = document.createTextNode(text);
 +
node.appendChild(linkText);
 +
document.getElementById("section_selector").appendChild(node);
 +
}
$(document).ready(function() {
$(document).ready(function() {
     $("#section_selector div").hide(); // Initially hide all content
     $("#section_selector div").hide(); // Initially hide all content

Revision as of 15:27, 16 July 2014