JavaScript JavaScript Basics Introducing JavaScript Link to an External Script

Kim Dallas
Kim Dallas
11,461 Points

alert within filename?

the alert warning is called within the file name

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


</html
shout.js

4 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 42,473 Points

Task 2 asks: Inside the shout.js file, write the code for an alert. You don't need to modify what you did in task 1.

Kim Dallas
Kim Dallas
11,461 Points

I did Kris. that's why I don't understand why it won't work. it's saying it has to have opening and closing script tags. I tried that too and it's not working

Otec Perez Glass
Otec Perez Glass
7,678 Points

Kim Dallas Hi there! I hope you’re doing well. when you are calling the SRC attribute and you assigned a path in your case you do not have to write code inside the <script > tag all of your JavaScript code should be place on the shout.js file like this.

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
  </head>
  <body>

  <script src="shout.js"> </script>
    </div>
  </body>
</html> // Also remember to close the </html> 

and then the Js file or shout.js file

alert ("You Did It!");