ajout
This commit is contained in:
13
WIM4.1/tp/tp2/ex1/favoris.html
Normal file
13
WIM4.1/tp/tp2/ex1/favoris.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="http://www.iut-fbleau.fr/css/tacit.css">
|
||||
|
||||
<script src="./js/favoris.js"></script>
|
||||
</head>
|
||||
<body container>
|
||||
<h1>Favoris</h1>
|
||||
</body>
|
||||
</html>
|
34
WIM4.1/tp/tp2/ex1/js/favoris.js
Normal file
34
WIM4.1/tp/tp2/ex1/js/favoris.js
Normal file
@@ -0,0 +1,34 @@
|
||||
let favoris = [
|
||||
{
|
||||
nom:"Google" ,
|
||||
url:"www.google.fr",
|
||||
img:"https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/200px-Google_2015_logo.svg.png"
|
||||
},
|
||||
{
|
||||
nom:"Le Monde",
|
||||
url:"lemonde.fr",
|
||||
img:"https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Lemonde_fr_2005_logo.svg/200px-Lemonde_fr_2005_logo.svg.png?uselang=fr"
|
||||
|
||||
},
|
||||
{
|
||||
nom:"L'Equipe",
|
||||
url:"www.lequipe.fr",
|
||||
img:"https://upload.wikimedia.org/wikipedia/commons/thumb/3/32/L%27%C3%89quipe_wordmark.svg/200px-L%27%C3%89quipe_wordmark.svg.png"
|
||||
}
|
||||
]
|
||||
|
||||
window.addEventListener("load",()=>{
|
||||
// TODO
|
||||
let body = document.body
|
||||
let ul = document.createElement("ul")
|
||||
for (f of favoris){
|
||||
let li = document.createElement("li")
|
||||
let a = document.createElement("a")
|
||||
a.href = "http://" + f.url
|
||||
let txt = document.createTextNode(f.nom)
|
||||
a.appendChild(txt)
|
||||
li.appendChild(a)
|
||||
ul.appendChild(li)
|
||||
}
|
||||
body.appendChild(ul)
|
||||
})
|
Reference in New Issue
Block a user