admin管理员组

文章数量:1345139

I have a web app that has a universal HTML header include, so I'd like to put page-specific scripts in each page instead of having it load for everything. I tried putting document.ready() near the end of the <body> of a page and it seems to be working fine. Are there any potential hazards to putting it there instead of inside the <head>?

I have a web app that has a universal HTML header include, so I'd like to put page-specific scripts in each page instead of having it load for everything. I tried putting document.ready() near the end of the <body> of a page and it seems to be working fine. Are there any potential hazards to putting it there instead of inside the <head>?

Share Improve this question edited Feb 3, 2009 at 23:09 Eric Wendelin 44.4k9 gold badges72 silver badges94 bronze badges asked Feb 3, 2009 at 23:05 MatthewMatthew 7,7357 gold badges41 silver badges39 bronze badges 1
  • Refer this thread stackoverflow./questions/17659121/… – Uday Vaswani Commented Mar 23, 2016 at 2:02
Add a ment  | 

2 Answers 2

Reset to default 8

Yahoo remends putting all scripts at the end of your document for performance - http://developer.yahoo./performance/rules.html

None. Just make sure everything is loaded in the proper order.

本文标签: javascriptdocumentready inside body tagStack Overflow