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
1. What is positioning? The position attribute in...
Preface gdb is a very useful debugging tool under...
Table of contents Review of Vue2 responsive princ...
Table of contents 1. The role of nginx process lo...
The first web page I designed is as follows: I ha...
Creating a Vue 3.x Project npm init @vitejs/app m...
In the process of writing the project page, I enc...
1. Create table statement: CREATE TABLE `employee...
I started learning MySQL recently. The installati...
Table of contents Start and stop Database related...
Preface This article is just a simple record of m...
MySQL error: Parameter index out of range (1 >...
count(*) accomplish 1. MyISAM: Stores the total n...
Preface I recently wrote a small demo. Because I ...
The code looks like this: <!DOCTYPE html> &...