Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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,558 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.