+ 1

This code doesn't work, why?

<!DOCTYPE html> <html> <head> <title>Feeling good?</title> </head> <body> <h1> How are you feeling? </h1> <o> <button onclick="show()">Sad</button> </o> <e> <button onclick="result()">Happy</button> </e> <a> <button onclick="see()">Bored</button> </a> <script type="text/jascript"> var x = document.getElementById("o"); var x = () => { function show(){ document.write('Dress with a blue shirt and jeans') } } var y = document.getElementById("e"); var y = () => { function result(){ document.write('Dress with a yellow t-shirt and brown trousers') } } var w = document.getElementById("e"); var w = () => { function see(){ document.write('Dress with a long black sleeve') } } </script> </body> </html>

4th Jul 2018, 7:25 PM
Marcello Muratori
Marcello Muratori - avatar
5 Antworten
5th Jul 2018, 12:53 PM
_F1_
_F1_ - avatar
+ 8
And Marcello Muratori , in the <script> tag I’ve added an short explanation!
5th Jul 2018, 1:05 PM
_F1_
_F1_ - avatar
+ 7
Marcello Muratori No thanks, this is SoloLearn!😎 We can always help you!
5th Jul 2018, 5:35 PM
_F1_
_F1_ - avatar
+ 1
I don't understand, could you please write me the correct code, and maybe an explenation? Thank you very much
5th Jul 2018, 11:02 AM
Marcello Muratori
Marcello Muratori - avatar
+ 1
Thanks a lot, you were really helpful
5th Jul 2018, 5:17 PM
Marcello Muratori
Marcello Muratori - avatar