I used the label tag when I was doing something recently. Since I rarely used the label tag before, I encountered a very strange problem. What's the problem? Let's take a look at an effect Tip: You can modify some of the code before running The purpose of this demo is to verify whether the username and password entered by the user are legal when the login button is clicked. If they are not legal, an error message will be prompted below the username input box. The elements that prompt error information are planned to be implemented using labels. Open the demo page by running the code and click the login button to see what changes will occur. If you are using Firefox, Chrome, or IE9+, after clicking the login button, you will be prompted with "Wrong Username", which is the desired result. If you are using IE6, 7, or 8, how about checking out what changes will occur? At this time, you will find that the page does not prompt any information. Open the developer tools and look at the control. At this time, you will find that the error message "SCRIPT600: unknown runtime error" is prompted. When I encountered this problem, I tried both innerText and innerHTML methods, and found that both methods reported the same error. I thought that the usage was wrong, so I checked on w3cschool and found that it did not say that innerText and innerHTML were not supported. Why does this error appear in IE6, 7, and 8 while Firefox, Chrome, and IE9+ (other browsers have not been tried) run normally? Careful people may be able to see the problem at once. The starting tag of the element that prompts "Wrong Username" is written as "lable" instead of label. But I didn't notice this problem at the time. I always thought there was a problem with the way the label tag was used. As for why the JS engines of IE6, 7, and 8 would have errors when operating the innerText and innerHTMl attributes of such elements with incorrect tag names, while Firefox, Chrome, and IE9+ did not have errors, I am not very clear. If anyone who knows more about this, please explain it to me. This problem is actually quite low-level, the label name was written incorrectly. But I didn't notice it at the time. I only discovered this problem after careful study later, so I still recorded it. |
<<: Detailed process of Vue front-end packaging
>>: Sharing ideas on processing tens of millions of data in a single MySQL table
Table of contents 1. Create a socket 2. Bind sock...
Two small problems, but they bothered me for a lon...
Phenomenon The system could compile the Linux sys...
Table of contents Install tinymce, tinymce ts, ti...
Table of contents 1. Instructions for use 2. Prep...
Click here to return to the 123WORDPRESS.COM HTML ...
What Beautiful HTML Code Looks Like How to write ...
This article shares the specific code of JavaScri...
Table of contents View Disk Usage Disk Cleanup (D...
1. Introduction to MMM: MMM stands for Multi-Mast...
【SQL】SQL paging query summary The need for paging...
Services provided by NFS Mount: Enable the /usr/s...
Table of contents 1. Three functions of toString ...
Table of contents 1. Job Execution Fault Toleranc...
Prepare a CentOS6 installation disk (any version)...