问题描述
我想编写一个包含主页"、图库"、联系我们"、常见问题解答"等多个部分的小网站.
I would like to code a little web site that will contain several sections like "Home", "Gallery", "Contact Us", "FAQs", and so on.
我想通过将每个部分放在 div
中来在一个 HTML 中完成此操作,并且每次仅显示一个 div
(使用 Javascript/jQuery),基于所选菜单按钮.
I thought to do this in one HTML by putting each section in a div
and show only one div
per time (using Javascript / jQuery), based on the chosen menu button.
或者,我可以为每个部分创建一个单独的 HTML 页面,并将这些页面链接到菜单按钮.
Alternatively, I could create a separate HTML page per section, and link these pages to the menu buttons.
这两种方法的优缺点是什么?
What are the advantages and disadvantages of these two methods ?
推荐答案
第一种方法意味着更长的加载时间,因为您必须预先加载站点上的所有内容,对于禁用 Javascript 或浏览器不支持的人来说,这完全不合适不支持.第二种方法意味着用户只需加载他们实际查看的内容,即使使用非 JavaScript 浏览器也应该可以使用.
The first method means longer loading times since you have to load everything on the site up front, and it's totally broken for people who have disabled Javascript or whose browsers don't support it. The second method means the user only has to load the content they are actually looking at, and it should work even with non-Javascript browsers.
这篇关于包含单个页面的网站的优点和缺点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!