Line 2: | Line 2: | ||
<html> | <html> | ||
<head> | <head> | ||
+ | <script> | ||
+ | |||
+ | function letterEntry(letter){ | ||
+ | this.letter=letter; | ||
+ | var a = []; | ||
+ | |||
+ | var Header = document.createElement("h1"); | ||
+ | Header.innerHTML=letter; | ||
+ | var Url_name = []; | ||
+ | |||
+ | } | ||
+ | |||
+ | letterEntry.prototype.addLink = function(urlName){ | ||
+ | Url_name.push(urlName) | ||
+ | |||
+ | } | ||
+ | |||
+ | var entryBlocks = []; | ||
+ | |||
+ | document.onload= function Main(){ | ||
+ | |||
+ | //Generate an array for each letter; | ||
+ | var charCode = 65; | ||
+ | for(i = 0; i<26; i++;){ | ||
+ | entryBlock[i]= letterEntry(String.fromCharCode(charCode)); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | } | ||
+ | function addLink(Name_Url){ | ||
+ | for(i = 0, i<=len(entryBlocks); i++){ | ||
+ | if(entryBlocks[i].letter==(Name.toUpperCase())[0]){ | ||
+ | entryBlocks[i].addLink(Name_Url); | ||
+ | } | ||
+ | else{ | ||
+ | document.getElementById("error").innerHTML="ERROR IN LINK NAME"; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | function arrayToList(){ | ||
+ | entryBlocks.forEach(function(obj,index){ | ||
+ | |||
+ | obj.Url_name.sort(); | ||
+ | obj.Url_name.forEach(function(objec,index){ | ||
+ | var temp = objec.split(",",1) | ||
+ | var as = document.createElement("a"); | ||
+ | as.href=temp[1]; | ||
+ | as.innerHTML=temp[0]; | ||
+ | obj.a.push(as) | ||
+ | |||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | }); | ||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </script> | ||
</head> | </head> | ||
<div class="basic-page-body"> | <div class="basic-page-body"> | ||
<!-- 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> | ||
<h1>A</h1> | <h1>A</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>B</h1> | <h1>B</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>C</h1> | <h1>C</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>D</h1> | <h1>D</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>E</h1> | <h1>E</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>F</h1> | <h1>F</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>G</h1> | <h1>G</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>H</h1> | <h1>H</h1> | ||
+ | <ul> | ||
+ | </ul> | ||
<h1>J</h1> | <h1>J</h1> | ||
+ | |||
<h1>K</h1> | <h1>K</h1> | ||
<h1>L</h1> | <h1>L</h1> |
Revision as of 19:12, 12 June 2018