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

Ashlee Sharp
PLUS
Ashlee Sharp
Courses Plus Student 1,694 Points

I'm really not sure what I'm not understanding.

I am trying to write a function that will open an alert dialog with the message 'Warning!' inside the script tags, but I don't know what I am getting wrong. It keeps saying that task 1 is not longer passing, after I try to write the code like this.

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
  <script src="scripts.js"></script>
  <script>
    alert("Warning!");
  </script>
</body>
</html>

2 Answers

Eric Ayres
Eric Ayres
4,233 Points

Ashlee your alert is fine. all you have to do is eliminate the <script src="scripts.js"></script> line. you're trying to reference something that doesn't exist. Your on the right path your just getting a little ahead of yourself. As you can see you can't tab over to that scripts.js from the index,.html cause it hasn't been created just yet.

Ashlee Sharp
Ashlee Sharp
Courses Plus Student 1,694 Points

I understand completely now, duh, thank you so much for your help!

Trevor Johnson
Trevor Johnson
14,427 Points

You are linking to a separate js file, and then creating an <script> tag within that. You don't need to do that. You can write the function in your HTML file, or you can write it in scripts.js and link to it.

Ashlee Sharp
Ashlee Sharp
Courses Plus Student 1,694 Points

Oooh! I got it now, thank you so much for your help!