Difference between revisions of "Team:Purdue/Navpage"

Line 3: Line 3:
 
<head>
 
<head>
 
<script>
 
<script>
 
 
function letterEntry(letter){
 
function letterEntry(letter){
 
this.letter=letter;
 
this.letter=letter;
Line 11: Line 10:
 
var Url_name = [];
 
var Url_name = [];
 
var ulList;
 
var ulList;
 
 
}
 
}
 
 
letterEntry.prototype.addLink = function(urlName){
 
letterEntry.prototype.addLink = function(urlName){
 
  Url_name.push(urlName);
 
  Url_name.push(urlName);
 
 
}
 
}
 
 
var entryBlocks = [];
 
var entryBlocks = [];
 
Main();
 
Main();
Line 28: Line 23:
 
     entryBlocks[i]= letterEntry(String.fromCharCode(charCode));
 
     entryBlocks[i]= letterEntry(String.fromCharCode(charCode));
 
}
 
}
 
 
 
 
 
 
arrayToList();
 
arrayToList();
 
//now a tags are made, time to place them in an unordered list
 
//now a tags are made, time to place them in an unordered list
 
entryBlocks.forEach(atagsInList());
 
entryBlocks.forEach(atagsInList());
 +
}
  
 
 
}
 
 
function addLink(Name_Url){
 
function addLink(Name_Url){
 
for(i = 0; i<=len(entryBlocks); i++){
 
for(i = 0; i<=len(entryBlocks); i++){
Line 48: Line 36:
 
     document.getElementById("error").innerHTML="ERROR IN LINK NAME";
 
     document.getElementById("error").innerHTML="ERROR IN LINK NAME";
 
}
 
}
 
 
}
 
}
 
 
 
 
 
}
 
}
 
 
 
  
 
function arrayToList(){
 
function arrayToList(){
 
  entryBlocks.forEach(function(obj,index){
 
  entryBlocks.forEach(function(obj,index){
 
 
obj.Url_name.sort();
 
obj.Url_name.sort();
 
obj.Url_name.forEach(function(objec,index){
 
obj.Url_name.forEach(function(objec,index){
Line 69: Line 48:
 
as.innerHTML=temp[0];
 
as.innerHTML=temp[0];
 
obj.a.push(as)
 
obj.a.push(as)
 
 
 
 
});
 
});
 
 
 
});
 
});
 
 
 
 
 
 
 
}
 
}
 
 
function atagsInList(obj,Index){
 
function atagsInList(obj,Index){
 
//takes the link tags and adds them to a list
 
//takes the link tags and adds them to a list
 
obj.ulList = document.createElement("ul");
 
obj.ulList = document.createElement("ul");
 
 
obj.a.forEach(function(obje,index){
 
obj.a.forEach(function(obje,index){
 
var list_item = document.createElement("li");
 
var list_item = document.createElement("li");
Line 93: Line 59:
 
obj.ulList.appendChild(list_item);
 
obj.ulList.appendChild(list_item);
 
});
 
});
 
 
obj.Header.appendChild(obj.ulList);
 
obj.Header.appendChild(obj.ulList);
 
document.getElementById("div").appendChild(obj.Header);
 
document.getElementById("div").appendChild(obj.Header);
 
 
}
 
}
 
 
 
  
 
</script>
 
</script>
Line 108: Line 69:
 
<!-- This page is for the creation of an alphabetical pages link -->
 
<!-- This page is for the creation of an alphabetical pages link -->
 
<p id="error"></p>
 
<p id="error"></p>
 
 
 
 
  
 
</div>
 
</div>
 
 
 
 
</html>
 
</html>

Revision as of 12:38, 13 June 2018

Bootstrap Example