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 trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript Write Another Program

Fidel Zv
Fidel Zv
1,625 Points

I don't know how I am supposed to add an opening and closing script tag inside the body of the page. I'm a bit confused

This is what I did and it keeps telling me syntax error but have no clue how to fix it

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
  <script>
  alert("Here's another message from Treehouse");
  <script>
</head>
<body>
  <div class="container">
  <h1>where to place your Javascript code.</h1>
  </div>
  <script src="scripts.js"></script>
</body>
</html>

3 Answers

Hey Fidel,

You are going to want to put your <script> tags inside of the <body> tags make sure the closing </script> tag is within the nest of the closing </body> tag. For this challenge you are doing inline scripting and don't need a link to your external javascript page.

It would look like this.

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <h1>where to place your Javascript code.</h1>
  <script>
      alert("Warning!");
  </script>
</body>
</html>
Fidel Zv
Fidel Zv
1,625 Points

Thanks a lot Dylan