Problems and experiences encountered in web development

Problems and experiences encountered in web development
<br />The following are the problems I encountered during development and the experiences I gained. It took me some time to debug, and I post them here to help others avoid detours.
1. XML files should be encoded in UTF-8 as much as possible. Some characters in GB2312 cannot be stored, such as ?. Even if they can be stored, they need to be converted, which is troublesome. UTF-8 also complies with international standards.
2. In CSS, the :hover pseudo-class will become invalid if placed before :visited.
3. If the <a> tag does not have an href attribute, all CSS pseudo-classes for it, such as :hover, will be invalid.

4. In the js file, the reference is in the form of document.wirte("<script language='javascript' src='" file "'></" "script>", and the file relative path is the path of the HTML that references the js.
For example: a.htm references x\b.js, b.js references x\c.js, then the file should be x\c.js instead of the direct path c.js relative to b.js. However, this problem does not exist in the @import and url() references in CSS. 5. In the page, sometimes the width of the talbe is set to 100%, which will leave a blank space on the right side of the scroll bar. Please set <body style="overflow:auto">
6. For commonly used images, do not use the img tag. Use <span><a> and use CSS to specify its background and width and height. For dynamic ones (changing the background when moving), it is best to use <a>. No additional code is required. Just use the pseudo-class :hover. The advantage of using CSS is that all changes can be made at once, which can be well used in skin-changing applications.
7. @font-face {font-family:comic;src:url(http://valid_url/some_font_file.eot);}
Define a font name that is not available locally and call <span style="font-family:comic;font-size:18pt>aa</span>
8. Some CSS
div { overflow: hidden; text-overflow: ellipsis; }
td { vertical-align : middle; }
To force overflow to occur and the ellipsis value to be applied, the author must set the object's white-space property to nowrap.
If there is no opportunity for line breaking (for example, the width of the object container is narrow, and there is a long text without reasonable line breaks), overflow is possible even without applying nowrap.
In order for the ellipsis value to be applied, this property must be set to an object that has an invisible area. The best option is to set the overflow property to hidden.
9. Firefox's document.createElement does not support HTML tags in the content, nor does it support innerText, but it supports innerHTML, and you can use innerHTML to specify its content.
10. The width of DropDownList in .net control is not colored in Firefox, you need to directly define style='width:10px;'
11. The CSS cursor in Firefox does not support hand, use pointer instead.

12. The scroll bar in the iframe needs to be set with style='overflow:hidden' in the iframe tag. It cannot be set only in the body, otherwise there will be problems in Firefox.
13. In the onpropertychange event, pay attention to using event.propertyName to filter the property change event. When setting this event, the onpropertychange property has actually been changed, so it will be automatically executed once.
14. The version of XSL supported in js5.6 is relatively low, such as the document function is not supported.

15. The slice function is slower than directly looping to get array fragments.
16. When nextSibling obtains the next object, it is important to note that there should be no space between the two nodes, otherwise it is easy to fail to obtain the correct object.
17. When there is Chinese in CreateTextFile, the third parameter must be specified as true, otherwise Chinese cannot be written, which will result in an error when Write is called.
18. Use ADODB.stream when saving Chinese text, not fso, because FSO does not support utf-8 format.

<<:  MySQL query method with multiple conditions

>>:  WeChat Mini Programs Implement Star Rating

Recommend

JS operation object array to achieve add, delete, modify and query example code

1. Introduction Recently, I helped a friend to ma...

8 examples of using killall command to terminate processes in Linux

The Linux command line provides many commands to ...

Let's talk in detail about the props attributes of components in Vue

Table of contents Question 1: How are props used ...

Solution to the error reported by Mysql systemctl start mysqld

Error message: Job for mysqld.service failed beca...

5 ways to migrate Docker containers to other servers

Migration is unavoidable in many cases. Hardware ...

Implementing simple tabs with js

Tab selection cards are used very frequently on r...

Vue Element-ui implements tree control node adding icon detailed explanation

Table of contents 1. Rendering 2. Bind data and a...

Docker MQTT installation and use tutorial

Introduction to MQTT MQTT (Message Queuing Teleme...

Solve the problem of MySql client exiting in seconds (my.ini not found)

Problem description (environment: windows7, MySql...

A brief discussion on whether CSS will block page rendering

Maybe everyone knows that js execution will block...

Quickly solve the problem of slow and stuck opening of input[type=file]

Why is it that when the input tag type is file an...

Record a pitfall of MySQL update statement update

background Recently, I executed a DML statement d...

Three ways to check whether a port is open in a remote Linux system

This is a very important topic, not only for Linu...

Teach you step by step to configure MySQL remote access

Preface When using the MySQL database, sometimes ...

How to let DOSBox automatically execute commands after startup

Using DOSBox, you can simulate DOS under Windows ...