Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGeorge Akinian
17,615 PointsHI, when I try to load the file I get an Failed to load resource: net::ERR_FILE_NOT_FOUND how do I proceed ?
<!DOCTYPE html> <html lang="en"> <head> <title> Introduction to Programming</title> <style> html { background: #FAFAFA; font-family: sans-serif; }
</style>
<script src="myscript.js"></script>
</head>
<body>
<h1>Introduction to Programming</h1>
<h2>with JavaScript</h2>
</body>
</html>
AND myscript.js directory is same as the index.html directory
myscript.js
console.log("Hello from myscript.js");
2 Answers
Marcus Parsons
15,719 PointsHey Paul, a couple things to check just so we can make sure that we don't have any of the common errors here. First, I noticed that the code you copied in is missing an opening <html> and an opening <head> tag. While this won't affect the error message you received, it is good for solidarity.
Second, let's double check to make sure that the file, myscript.js, is located right alongside the index.html in the file browser. I have sometimes put a JS file into a folder named "js" and then completely forgotten about it.
Third, let's see if "myscript.js" has a filename that matches what is given in the HTML document. Go to the actual source of the file in your file explorer and ensure the filename is exactly "myscript.js". It is a common mistake for all of us to mistype a filename and then wonder why we can't get anything done haha.
If this has helped you and solved the error, hitting that Best Answer button would be great! :) Thanks!
Gregory Serfaty
37,140 PointsHi
Your script is load but like you put it in the beginning of you DOM your page is not ready when the script is load so put your script juste before the </body>
or in your javascript file put like this $(document).ready(function(){ console.log("Hello from my script"); )};