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 trialashmagupta
6,595 PointsThere are two files: a web page, index.html, and a JavaScript file, shout.js. To run any programming in the shout.js fil
There are two files: a web page, index.html, and a JavaScript file, shout.js. To run any programming in the shout.js file, you first need to load it into the index.html file. Add the required HTML to load the external JavaScript file into the web page. Make sure to add your code inside the <body> of the page.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body><script> src.shout.js </script>
</body>
</html>
16 Answers
Steven Parker
231,271 PointsThe src attribute goes inside the beginning script tag.
Then you need an equal sign between the attribute and the value, and it's good practice to enclose the value in quotes. So for example, to load a file named shout.js, you would add this to the HTML:
<script src="shout.js"></script>
yk2
8,550 PointsThis is how it should be done: <script src = "shout.js"></script>
You need to keep the first script tag open and close it after "shout.js" , also make sure you put quotes between shout.js
Tsion Gebregziabher
5,392 PointsI did like this ,but it is does not work for me <script src = "shout.js"></script> do you guys have any idea where I made mistake?
johnathon padilla
Courses Plus Student 337 Pointsim still confused
Nermeen Hamed
Front End Web Development Techdegree Graduate 14,137 Pointshere is my code <html> <head> <meta charset="utf-8"> <title>JavaScript Basics</title> <script scr="app.js"></script> </head> <body>
</body> </html>
how can I know what should I put in body , could you please help me ?
ashmagupta
6,595 PointsThanks Steven
Moinuddin khan Mohammad
Courses Plus Student 1,863 PointsI am still getting error when write the code in the belwo format
<script> src=shout.js </script>
Can anyone help why i am getting the error like i am missing the end tag like <script>, what is the solution.
omarrlanedirect
130 Pointssrc should be enclosed :)
johnathon padilla
Courses Plus Student 337 Pointsnever mind i got it
Shuvam Roy
2,753 Points<script src="shout.js"></script>
yk2
8,550 PointsHow come when I type this, I get an error message?
<body> <script src="shout.js"></script>
</body>
Steven Parker
231,271 PointsWhat error?
Moinuddin khan Mohammad
Courses Plus Student 1,863 PointsPerfect thanks for the help.
Mustafa Abrams
10,288 Points</head> <body> <script src="shout.js"></script> </body> </html>
Welcome Julius
9,076 Pointssteven parker please i dont am not getting the code right bummer keeps coming on
Steven Parker
231,271 PointsYou need to show your code to make it possible to identify the issue.
Also, always create a fresh, new question instead of adding one as an "answer" to an old one.
ROBERT BUTLER
2,010 Points<body> <script src="app.js"></script> <body>
This is correct.
nkhuyeyi sibande
855 PointsDid you specify the correct file -- app.js
-- for the src
attribute? thats the error code I keep getting
Dereje Dessalegn
2,408 Pointsit should specify to < script src="app.js"></script>
bezawit hailemariam
1,939 Points<script src="app.js"></script>