defTitre3 ok

This commit is contained in:
JunkJumper
2020-01-22 17:39:33 +01:00
parent e5d959e93d
commit e21b99674b
2 changed files with 17 additions and 1 deletions

View File

@ -2,7 +2,7 @@ console.log("JavaScript is linked");
function init(){
sayHello();
defTitre2();
defTitre3();
}
function defTitre1() {
@ -20,6 +20,18 @@ function defTitre2() {
}
}
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 ! /:")
}
}
function sayHello() {
console.log("Hello Everypony !");
}