37 lines
919 B
JavaScript
Raw Normal View History

2020-01-22 16:40:43 +01:00
console.log("JavaScript is linked");
function init(){
sayHello();
2020-01-22 17:39:33 +01:00
defTitre3();
2020-01-22 16:40:43 +01:00
}
2020-01-22 17:02:42 +01:00
function defTitre1() {
if(document.title = document.getElementById("titre").innerText) {
console.log("<title> set : Ok Everypony !");
}
2020-01-22 16:40:43 +01:00
}
2020-01-22 17:27:33 +01:00
function defTitre2() {
var firstH2 = document.getElementsByTagName("h2");
if(firstH2 != null) {
document.title =firstH2[0].innerText;
console.log("<title> set : Ok Everypony !");
}
}
2020-01-22 17:39:33 +01:00
function defTitre3() {
var lastH2 = document.getElementsByTagName("h2");
if(lastH2 != null) {
document.title = lastH2[lastH2.length-1].innerText;
console.log("<title> set : Ok Everypony !");
} else {
document.title = "Page par Pauline Célestiale";
console.warn("There is no H2 tag on this page Everypony ! /:")
}
}
2020-01-22 16:40:43 +01:00
function sayHello() {
console.log("Hello Everypony !");
}