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

Open an alert dialogue message

The task is asking me to add alert(‘Warning) inside of the </script> Tags. I did and it still has changed anything.

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="script.js" 
          alert="Warning">
  </script>

</body>
</html>

2 Answers

  <script src="script.js" >

alert("Warning"); //try putting it inbetween script tags. alert(); is a javascript built in function. functions are called with (); following the name. 

  </script>
Steven Parker
Steven Parker
231,271 Points

There are two kinds of "script" tags. One kind has a "src" attribute that names an external file to be loaded and run. That kind should not have any code between the start and end tags.

The other kind does have code between the tags, but it does not have a "src" attribute in the start tag. That's the kind you need for this particular challenge. Then use JavaScript syntax inside the tags for calling the function, and be sure the code is between the tags and not inside the start tag:

  <script>
          alert("Warning");
  </script>