+ 2

I have problems with my Javascript code

I have made a small reaction test game. Curiously if I try it locally on my PC in Firefox and Chrome it is working fine, but within the player of sololearn I got errors thrown, and it is not working at all. Does anybody have a idea of my fault? Thanks Here is the code: https://code.sololearn.com/WjePfIGf2ubH

18th Nov 2020, 1:36 PM
Joerg Blum
Joerg Blum - avatar
2 Antworten
+ 3
do you mean "cannot set onclick property..."? then you just have to put your javascript code after your html text inside script tag, or you can just wrap your code inside window onload event that happen because your js code gets executed first before your html file
18th Nov 2020, 2:01 PM
durian
durian - avatar
+ 2
Ahhh Great, that is why it worked on my local system, there I had the script also located under the body. Now it is working fine! Thanks!
18th Nov 2020, 2:04 PM
Joerg Blum
Joerg Blum - avatar