Jump to content

noobdesigner

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About noobdesigner

  • Rank
    Newbie
  1. Ok, thank you very much. So that is how its works.The Book i am working on, did not say anything about it...
  2. Hello, first of all, sorry for the extremly nooby quastion and my not so good English, but this makes me insane. My HTML Code --> index.html: <html> <head> <script src="main.js"></script> </head> <body> <input id="btn" type="button" value="Button"> </body> </html> And my JavaScript Code --> main.js: function test() { alert("Test"); } btn.addEventListener ("click", test); It is written everywhere, that the <script src="xyz"></script> should be written as high as possible, respectivly within the <head> Tags. But the code above do not work --> Why?? The code works only if my script is written/loaded after the <input> Tag. Is this works as desinged? Should the script import really written at the end of the HTML page? Thanks in advance.
×
×
  • Create New...