-1

At the moment, the files setup looks like this: File Setup in the merkur.html file I use this to go to the JS files:

<script src="../scripts/ui.js"></script>
<script src="../scripts/index.js"></script>

The JS is only working on the index.html, in the merkur.html I get the error: Error Message

Can somebody help me?

Moreno
  • 1
  • 2
  • https://meta.stackoverflow.com/questions/285551/why-should-i-not-upload-images-of-code-data-errors-when-asking-a-question – Cesare Polonara May 07 '22 at 09:26
  • 2
    The error has nothing to do with loading the script. There is an error in you JS code. Probably you are searching for an HTML element, that doesn't exist and then performing `.getAttribute()` on it – Apollo79 May 07 '22 at 09:26

2 Answers2

1

In your index.html file, keep the links to your JavaScript files as bellow.

<script src="scripts/ui.js"></script>
<script src="scripts/index.js"></script>

In your merkur.html file, keep the links to your JavaScript files as bellow.

<script src="../scripts/ui.js"></script>
<script src="../scripts/index.js"></script>

If you are still getting errors, you may have do something wrong in your JavaScript codes. Maybe you are trying to search for an HTML element which doesn't exist in your relevant HTML code.

Thanks and best regards!

0

You can use js files in any html document. The only one problem here is a path you wrote for merkur.html file.

So just read how to deal with path to files. Especially ../ & ./

Vetos
  • 96
  • 2
  • 11