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!

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


jang walia
jang walia
7,717 Points

html lagging behind

when i run my code ,the javascript alert and prompt appears on screen leaving sceen blank in the back. the background image is not shown while the javascript is running..?? i have built a simple quizz programme so that why i have added javascript .

kindly help

eslam said
eslam said
Courses Plus Student 6,734 Points

Because probably you have your script tag inside the head so instead put your script tag before the ending on the body tag like so :

      <script src="yoursource.js"></script>

Hi jang walia ,

Can you provide the code so other students can help you. eslam said is most likely correct and his answer should fix your problem.

Gari Merrifield
Gari Merrifield
9,597 Points

There's some info in this article, and some corrections in the comments : https://javascript.info/onload-ondomcontentloaded

And there is an interesting conversation on the topic here on the community as well : https://teamtreehouse.com/community/why-i-can-see-the-result-of-documentwrite-only-after-all-the-prompts-and-alert-messages-disappear

Hopefully some of that helps..

1 Answer

Óscar Hernández sandoval
Óscar Hernández sandoval
9,257 Points

Put the js in the bottom before the closet body Tag.