+ 1

Please, why these warnings ?

Hi, I'm learning javascript, css and html. And I have these warnings : 1ERROR: 'erreur' is defined but never used. [no-unused-vars] function erreur() { 2ERROR: 'document' is not defined. [no-undef] document.getElementById("correction").innerHTML = "Non, tu te trompes !"; 5ERROR: 'bravo' is defined but never used. [no-unused-vars] function bravo() { 6ERROR: 'document' is not defined. [no-undef] document.getElementById("correction").innerHTML = "Bravo !"; I don't understand why ? Thanks to help me. This my code. <!doctype HTML> <html> <head> <link href="style.css" rel="stylesheet" </head> <body> <h1>Le verbe</h1> <h3>Trouve le verbe</h3> <div class="p1"> <p>Pierre et Sarah mangent un gâteau.</p> </div> <div class="boutons"> <button onclick="erreur()">Pierre</button> <button onclick="erreur()">Sarah</button> <br> <button onclick="bravo()">mangent</button> <button onclick="erreur()">gâteau</button> <p id="correction"></p> </div> <script src="script.js"> </script> </body> </html> in the file script.css function erreur() { document.getElementById("correction").innerHTML = "Non, tu te trompes !"; } function bravo() { document.getElementById("correction").innerHTML = "Bravo !"; }

4th Aug 2020, 5:10 PM
Fanfan45
3 Answers
+ 3
If you can link the code instesd of copy pasting that will be much better ,I just ran the code and it works fine Also I think you mean script.js ? css is for styling elements not for writing functions !
4th Aug 2020, 5:19 PM
Abhay
Abhay - avatar
+ 3
As Abhay said it works fine and link your code if possible next time Here's your code https://code.sololearn.com/WCI3fAfct7l9/?ref=app
4th Aug 2020, 5:24 PM
v@msi😉
v@msi😉 - avatar
+ 1
Thank you for your answer. Sorry, I didn't think about it (make a link in sololearn). But next time I will !
4th Aug 2020, 6:13 PM
Fanfan45