search
HomeWeb Front-endHTML TutorialA page optimization guide (easyui page optimization plan) developed by me for the project team_html/css_WEB-ITnose

#本人为项目组制定的一份页面优化指南(easyui页面优化方案)##背景这是一篇我之前为项目组制定的页面优化指南,主要是面向表单页面,典型的像[注册用户](https://passport.cnblogs.com/register.aspx)那样的页面。本人的项目主要是基于easyui的,一开始都是直接用其中的layout进行布局,但对于一个实际项目中有100-200甚至更加多字段的表单项,载入的效率很成问题经过**本人的分析**(具体的分析过程见[这里](http://www.cnblogs.com/p2227/p/3540858.html)),发现layout,datebox,combobox及一些panel的衍生组件(其实datebox和combobox中也有panel)都是罪魁祸首所以本人重新写了一个针对表单页面的优化方案,包括文档和相应的代码,本博主要是其中的文档部分##文档如果文档在网页上显示有问题,可以直接下载[PDF格式](http://files.cnblogs.com/p2227/%E9%A1%B5%E9%9D%A2%E4%BC%98%E5%8C%96%E6%8C%87%E5%8D%972.pdf)>页面(登记表)优化指南一、	文档目的引导及记录一套项目页面(尤其是登记表页面)的优化方案二、	优化要点1.文档声明文档声明必须置于网页的HTML部分的最开始,标签之前。它影响着整个网页的解释(兼容性及效率问题)。目前项目中使用的声明是<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">`PS:其实本人还是倾向于向前走,拥抱HTML5的`2.HTML架构页面元素结束之前不要放太多的script标签,一个带src的script标签会引起一次请求,如果标签中的代码另外发起了ajax请求更加需要置后。为了便于开发,一部分通用的JS可能置于body之前,即整体代码架构如下://在body之前放置一些通用JS<body class="wds-layout-body><div id="center-layout" class="wds-layout-scroll wds-layout-north">主体内容</div><div id="south-layout" class="wds-layout-button wds-layout-south">下方按钮</div></body>//在body之后放置一些业务JS,尤其是当中有ajax请求的js3.内容布局3.1	尽量少用easyUI的Panel及Panel的衍生组件(layout,Tabs,datebox)去布局3.2	对于登记表,必须要有**<html>** 及 **<body>**元素。具体代码结构如下:(参考某某页面`这里跟项目实际路径有关,省略`)<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml">//其他代码<body class="wds-layout-body"><div id="center-layout" class="wds-layout-scroll wds-layout-north">主体内容</div><div id="south-layout" class="wds-layout-button wds-layout-south">下方按钮</div></body></html>再执行一下js代码:**$.applyLayout();**则会生成一个固定有north和south布局的页面4.字典项4.1	简单的、变化小的字典项(4项及以下)应该直接radio/checkbox置于页面新封装$.omDic()组件,参考dicQuery.js,使用方法:`此处省略100字,因为是跟项目后台有关联的`5.选择器尽量少避免使用复杂的选择器,能直接用ID尽量用ID选择。6.子表子表不用tab页方式展示,利用点击按钮后弹出对话框的方式展现。7.折叠如果内容太多,需要折叠分类显示,则在相应的行上面加上  ```htmlclass="list_colspan" ```即可,逻辑处理置于**$.applyLayout**函数中(不要用easyUI的accordion)三、	注意问题1.养成良好习惯,HTML元素要正确闭合,javascript中不要放置多余的逗号在eclipse中用正则表达式 ```html ,\s*[\r\n][\r\n]\s*\} ```去搜索,能查找出js中多余的逗号2.能用HTML完成的内容尽量不要用CSS/JavaScript去完成,能用CSS去完成的内容尽量不要用JavaScript去完成如鼠标提示最省资源的方式是用title属性去完成,其次用:hover伪类,用JavaScript事件最耗资源3.项目内容稳定后,应该将变化小的HTTP请求(如查询字典)改成get请求以缓存4.项目内容稳定后,应该将js及css压缩、合并以减少请求时间5.项目内容稳定后,应该将图片合并,利用css sprite定位,以减少请求次数##优化后的页面示例[DEMO](http://p2227.github.io/demo/applyLayout/playout.html)

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),