This repository was archived by the owner on Apr 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader-generique.js
More file actions
executable file
·85 lines (48 loc) · 2.25 KB
/
header-generique.js
File metadata and controls
executable file
·85 lines (48 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
JS du Header Generique
=========================
*/
// on définit la liste des projets (dans un Array javascript) :
var ListeProjets = [
[ 'Histoire du pays', 'lien-histoire' ],
[ 'La géographie', 'https://eaa-3imd-2017.github.io/2-geographie/' ],
[ 'L’économie portugaise aujourd’hui', '#' ],
[ 'Histoire de l’immigration portugaise en Suisse', 'https://eaa-3imd-2017.github.io/4-immigration/' ],
[ 'Données démographiques : population résidente et flux migratoires', '#' ],
[ 'Répartition géographique de la population portugaise', '#' ],
[ 'Intégration socio-économique de la population portugaise en Suisse', '#' ],
[ 'Vie sociale et culturelle, structuration de la collectivité portugaise en Suisse', 'https://eaa-3imd-2017.github.io/8-vie-social/' ],
[ 'Langue et maintien de la culture d’origine', 'https://eaa-3imd-2017.github.io/9-langue/' ]
];
window.addEventListener("load", ProduceHeader, false);
function ProduceHeader() {
// on définit l'élément cible:
var navProj = document.getElementById("nav-projets");
// on crée les contenus:
// Le H1:
var navProjH1 = document.createElement("h1");
navProjH1.innerHTML = "La communauté portugaise en Suisse";
navProj.appendChild(navProjH1);
// Le label: <label for="nav-check">
var navProjLabel = document.createElement("label");
navProjLabel.htmlFor = 'nav-check';
navProjLabel.innerHTML = "<span>menu</span>";
navProj.appendChild(navProjLabel);
// Le input: <input type="checkbox" id="nav-check"/>
var navProjInput = document.createElement("input");
navProjInput.setAttribute('type', 'checkbox');
navProjInput.id = 'nav-check';
navProj.appendChild(navProjInput);
// Le menu:
var navProjOL = document.createElement("ol");
var navProjMenu = '';
// on utilise une boucle pour afficher les données contenues dans ListeProjets
for (var i = 0; i < ListeProjets.length; i++) {
var Projet = ListeProjets[i];
// on produit ceci : <li><a href="#">Histoire du pays</a></li>
navProjMenu += '<li><a href="' +Projet[1]+ '">' +Projet[0]+ '</a></li>';
}
navProjOL.innerHTML = navProjMenu;
// on insère les contenus
navProj.appendChild(navProjOL);
};