Author's note: Nothing happened when I used the onchange event today. Finally, I checked the information and found out about the limitations and instability of Onchange. But onpropertychange can be implemented very well, especially its real-time capture performance, which is worth using (Thanks to this performance, the boss lady is very satisfied with what I made o(∩_∩)o...).
I am also quite lazy, and I am too lazy to sort out the things I have made. I can only share the original version of the information I searched for:
Under IE, when the properties of an HTML element change, it can be captured through onpropertychange. For example a
When the value attribute of the
object is modified by the script on the page, onchange cannot be captured, but onpropertychange can. ( is captured in real time)
In other words, : onpropertychange can capture changes in attribute values in time, while onchange is in the attribute When the value changes, the current element must lose focus (onblur) to activate this event!
For example:
Example 1:
Please enter the image address:
When the content in the text box is changed, the picture will be displayed immediately. And if you use onchange, when changing its value, you need to use the mouse to click on a blank space or other place to make the input element lose focus (onblur) to activate the event and the image display will be changed!
Example 2:
-------------------------------------------------- --------------------
onpropertychangeThe event is so cute, I fell in love with it at first sight
onChange:An event triggered when the current element loses focus and the content of the element changes [can be triggered by mouse and keyboard]
So when the value of the object is changed by the script, the onChange event will not be triggered because the user neither moves the mouse nor the keyboard.