document.ready内部标签 [英] document.ready inside body tag

查看:88
本文介绍了document.ready内部标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有通用HTML标头包含的Web应用程序,因此我想在每个页面中放入特定于页面的脚本,而不是将其加载到所有内容中.我尝试将document.ready()放在页面<body>的末尾附近,看来工作正常.将其放置在<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>?

推荐答案

Yahoo建议将所有脚本放在文档的末尾以提高性能-

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

这篇关于document.ready内部标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆