Today, during the process of using connection for form submission, I discovered that setting the type attribute in the tags "input" and "botton" turns out to be a science.
During the development process, in order to make the html code cleaner, I first used the YAHOO.util.Event.addListener(obj, "click", callback) class to load the "click" event to submit the form, YAHOO.util.Connect. The asyncRequest('POST') method is used to upload form data. If the form information is incorrect, return processing is performed. The submit button I use is .
At this time, I found that except for IE6, which can process my form data correctly, FIREFOX, including IE7, cannot respond to my error handling (in the callback method, the error handling method is: as soon as an error is encountered , then return by returning false).
What I was thinking at this time was that I had already done the return process before submitting the form data in the statement, but the page was still refreshed.
I went home in the evening and tested the problem I encountered today again. It turned out that I overlooked one thing. The data was indeed submitted, and various data can be clearly seen in the address bar. The fact is that It proved that the data must have been submitted, so I thought of my button. The category setting of the button is "submit". When writing code before, it was always directly in "input" or "button". If the category is set to "submit" ", it is always written like this: onclick="return fun();" or onclick="fun(); return false;"; naturally there will be no problem. The strange thing is that the value of the addListener class is not directly If it affects the button, once the button is clicked, the data will naturally be submitted.
What a tragedy~~~~
Attachment: The default type value of button is submit, so it is best to mark the category! ! ! Remember!