Take the 2-minute tour ×

    <script type="text/javascript">
    <script type="text/javascript">    

As the code above.If I remove alert('789');, the order of appearance would be 123->456. If I remove alert('123');, the order would be 456->789. If I don't remove any of the two js statements, the order of appearance would be 123->789->456. Isn't it a bit strange?

share|improve this question
You have rep > 500, please take the time to look at the Markdown help page if you've forgotten how to post code. –  David Thomas Apr 20 '12 at 23:28
@David Thomas: They changed the way to post code samples since the last time I came here and it is frustrating to figure out how to use it. It was not explaind well. –  Aperture Apr 20 '12 at 23:31
Who wrote the Markdown help? Can't understand it. –  Aperture Apr 20 '12 at 23:34
When I test this in Chrome, I get 123->456->789 as the order of appearance: jsfiddle.net/y6Tje. It's likely to depend on how a browser decides whether or not it has enough information to start rendering the current tag contents. In this case, the <body> tag hasn't been finished processing, so some browsers may wait until reaching the end of the tag before rendering. –  mellamokb Apr 20 '12 at 23:38
I would not say it is strange. It is HTML engine (the browser) implementation dependent. that is all. That is why I try to use events to invoke my scripts. –  akonsu Apr 21 '12 at 3:51

Your Answer



Browse other questions tagged or ask your own question.