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 trialMuneer Bhamani
1,825 Pointsstory.js doesn't load. Please HELP!
Here is my program:
alert("Welcome to Madlibs!");
alert("Let's have some fun!");
var noun = prompt("Please type a noun.");
var verb = prompt("Please type a verb in the past tense.");
var adjective = prompt("Please type an adjective.");
var adverb = prompt("Please type an adverb.");
alert("You're done!");
document.write("<h2>A Day At The Zoo!</h2>");
document.write("<p>Today I went to the zoo. I saw a " + adjective + noun + " jumping up and down in it's tree. He " + verb + " " + adverb + " through the large tunnel that led to its " + adjective + " " + noun "." </p>");
Moderator Edited: Add Markdown so the code is readable in the Community Post. Please, in the future, refer to the Markdown Cheatsheet on how to properly post code in the Community.
8 Answers
Jason Anders
Treehouse Moderator 145,860 PointsI think you are missing a "(quotation mark) near the end. Have a look at the formatted code and see where the error highlighting is.
:)
Mark Pryce
8,804 PointsI do believe Jason is right, you need to include your </p> tag in quotation marks, either include it inside the period string or concatenate it on the end.
document.write("<p> This is just an example " + example + " of html tags inside of quotation marks. </p>");
As far as I am aware html tags will only work within a string. your browser will still treat it as html :)
Make sure you link your script to your index.html inside <script>
Happy coding.
Tanya Staples
1,320 PointsStory.js also doesn't load for me.
Muniir Gopaul
1,457 Pointsdocument.write("<p>Today I went to the zoo. I saw a " + adjective + noun + " jumping up and down in it\'s tree. He " + verb + " " + adverb + " through the large tunnel that led to it\'s " + adjective + " " + noun + "." + "</p>");
If you have not resolved this already, try
- escaping it\'s
- adding a " + " like above after noun.
- enclosing the closing </p> in ""
Hope this helps Cheers.
Michael McGraw
1,402 PointsTanya Staples did you create the file 'story.js' in the root directory?
Muneer Bhamani
1,825 PointsI tried your suggestions but still no resolve. The alerts, prompts and document.write aren't loading.
Alisha Evans
1,527 PointsMuneer Bhamani did you try removing the paragraph tags altogether from the 2nd document.write statement?
David Ayala
1,409 PointsDid you link the script file in the html document?
<script src='story.js'></script>
I think this is placed below the link in the header and before the title.
Kyle Griffith
587 PointsRight click on the left side of the Workspace and create a new file and name it " story.js" then copy and paste the code you already made into that. That's what I had to do and it worked for me.
Kevin Li
2,634 PointsKevin Li
2,634 PointsYes. Delete the quote mark before the final </p> and after the period.