|
Five errors that programmers often make in terms of page friendliness and their correction methods:
I am a well-behaved web user, but I think this also helps me become a good web developer. When I see an unpleasant design on a website, I am very angry. why are some simple things not doing well? The following are five common availability errors and solutions to these problems. Make it easy for you and people to make sure you do not make such mistakes.
Use the form label form instead of the click event to express the submit event!
I don't know how many times I 've encountered. when I used the Enter key to submit a form (or I used the arrow or enter the key on my phone), nothing happened. I had to click the submit button again, and the form finally responded. This is one of my most hated problems with the availability of web pages. You can click the submit button, or close the keyboard on your mobile phone and scroll to the bottom of the page to find the submit button. this is a nasty redundant action and does not need to be done at all. You only need to use the submit event to make the webpage much more friendly:
Document. getElementById ("myForm"). addEventListener ("submit", function (e ){
E. preventDefault ();
//... Do processing here. Yay for "enter" key submission!
Return false;
});
If you make such a mistake somewhere, correct it immediately.
Do not prevent click events when the [CONTROL] or [META] key is pressed.
I am a person who likes to open web pages on a new browser tab. recently I am looking for a new house. I will open many website pages at the same time and click images to view them. Unfortunately, all these pages are displayed on the same tab. Annoying. Before using the preventDefault method for any link, check whether the user has pressed the [CONTROL] or [META] Key:
Document. getElementById ("myLink"). addEventListener ("click", function (e ){
// E. preventDefault (); (bad)
If (e. meta | e. ctrlKey) return; // if you want to open a new window, open
E. preventDefault ();
});
This is what I do on my website. users will not encounter similar problems when opening new tabs. Do not force your users to keep clicking the back button on your website!
When setting text-overflow: ellipsis, add the title attribute to your webpage element,
Some new CSS attributes or attribute values are very useful, such as text-overflow: ellipsis. In the past, programmers often used methods to achieve this effect. I agree to use text-overflow: ellipsis, but when I hover over this element, you 'd better use the title attribute to display the complete information:
I am somereally, really long text that's going to be ellipsized
If you do not want to output the same content twice, you can use Js to dynamically set the title. No matter how it is implemented, consider it for the user.
Don't forget: focus and: active!
Many people ignore their statuses when designing styles for page elements. they only consider the use of the mouse, and forget that the user may be using the keyboard. Use focus and active to indicate their statuses:
A: hover, a: active, a: focus {/* change their style */
Color: #900;
}
Do a good thing for users: next time you develop a website, use the tab key to traverse all the elements on the page. if you press the tab without a key, the page does not have any focus changes, check your style sheet to see if you forget to add some state styles to them!
Please use the search/email text box type
When filling in form information on mobile phones, tablets, and other mobile devices, I encountered a very troublesome problem because I had to switch the keyboard mode to find the "@" character. I hope Web developers can be more mature and learn to use the correct text box type:
A slight modification can bring great convenience to your mobile phone users.
We programmers often make many mistakes. I will write more articles in this regard in the future, but it is certain that most of these mistakes are easily corrected, as long as you notice them.
Get free LAMP Brothers original PHP video tutorial CD/the elaborate PHP Essentials edition, details consulting official website Customer Service: http://www.lampbrother.net
You can subscribe to the email and I will share IT tutorials and books from time to time. Http://list.qq.com/cgi-bin/qf_invite? Id = ea7d919ad268249bce2be53a3e16da0f0ec55ac36513c68e
|