Home > Web Front-end > JS Tutorial > body text

Check whether each input input is legal. There will be problems when encountering Chinese character input_Form special effects

WBOY
Release: 2016-05-16 17:53:29
Original
1079 people have browsed it

Record the information, test it in the next few days and then publish the results

Copy the code The code is as follows:




Execute the above code and you will find 1 and [object] pop up, which shows that the event only passes one parameter to the callback function and it is of object type.
Then let’s try traversing this object.

Copy code The code is as follows:




Execute it and find that there are many attributes, but if you look closely, we may find such an attribute: propertyname, I believe everyone can guess the meaning of this property. Yes, this is used to get which attribute has been modified.

Copy code The code is as follows:




3. Let FF support similar effects to onPropertyChange

I have done a real-time verification of the input box before. For example, only numbers are allowed to be entered, but the user enters letters, etc. At this time, the user enters The value turns red, etc... or the prompt for the remaining input characters in the textarea text field, I encountered a problem. Using onPropertyChange is fine and normal under IE, but it has no effect on FF~~~

So I found a feasible method on the Internet~~ Firefox has an oninput event that has the same effect as onPropertyChange, so adding oninput and onPropertyChange at the same time will solve the problem~~~ oo....

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template