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 trialSavannah Walters
401 PointsDo I have to add, <script src+"script.js"<>/script> before my alert in the body? Why is it telling me it is wrong?
The computer is saying my formula is incorrect? can you shed some light on what I am doing wrong?
<!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>
3 Answers
andren
28,558 PointsThis challenge does not want you to add more than one <script>
tag. And it does not want you to link to an external script file, it just wants you to add the alert
code within the <script>
tag.
Like this:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript Basics</title>
</head>
<body>
<script>
alert("Warning!");
</script>
</body>
</html>
Hugo Buenrostro
10,620 PointsJust remove the first script tags (<script src=""></script>) that's causing the error. In the excercise you just have to show an alert.
Savannah Walters
401 PointsThanks so much for your help!!
stephen henderson
Courses Plus Student 6,181 Pointsstephen henderson
Courses Plus Student 6,181 PointsTheres nothing wrong with putting the <script src="scripts.js"></script> in the body tag (But I would recommend putting it just above the closing body tag </body>. Your problem is you are trying to code javascript in html. The alert function is to be written in a js file