Problems caused by naming the name of the form item submit or reset
Updated: December 22, 2007 01:01:25 Author:
Recently, a friend used a form named keyword in form and caused it to be unable to reset and submit. It turned out to be this problem.
Recently, a friend used a form named as a keyword by form, which caused the problem of reset and submission. It turned out that this question was "Accused of an error by calling [0].reset()?" and asked him immediately: "Does there be a form on the page?" and answered: "Yes". "You alert [0]", "Pop up object". That's strange, when does form have a reset method?
After looking over, alert([0].reset) found that the object popped up is wrong. It should be the reset local method popped up. Searching for reset, I found that the original reset button name is reset, no wonder it went wrong. [0].reset points to the reset button, not the form's reset interface.
Remove name="reset" and everything is OK!
In fact, I also found that the name of its submit button was submit. I guess the submit method would also make an error!
Sweat it: I don’t know if it was generated by the software or written by him. Anyway, be careful not to name these keywords, as unexpected errors are likely to occur!
After looking over, alert([0].reset) found that the object popped up is wrong. It should be the reset local method popped up. Searching for reset, I found that the original reset button name is reset, no wonder it went wrong. [0].reset points to the reset button, not the form's reset interface.
Remove name="reset" and everything is OK!
In fact, I also found that the name of its submit button was submit. I guess the submit method would also make an error!
Sweat it: I don’t know if it was generated by the software or written by him. Anyway, be careful not to name these keywords, as unexpected errors are likely to occur!
Related Articles
A nice drop-down list that removes the gray inverted triangle button
A nice drop-down list that removes the gray inverted triangle button...2007-06-06JavaScript input box content format verification code
When the mouse focus is moved to the password input box, use the js script to automatically verify whether the user name is formatted correctly or not.2010-02-02Text box that will automatically rise line by line
Text boxes that will automatically rise line by line...2006-06-06Simulate select scripts with javascript and css
Traditional select controls are ugly, and they cannot achieve good results with css beautification. It is easy to combine JavaScript and css to simulate a select with elements such as div to achieve the desired effect.2008-06-06FileUpload control Implementation code that prohibits manual input or paste
FileUpload control prohibits manual input or paste implementation codes and are often used for relatively safe and error-free inputs, such as ID number, password, bank account, etc.2010-04-04About search input box
About the search input box...2006-10-10Data transfer code between Javascript forms
Today, a friend asked me about using JAVASCRIPT to pass data between various forms on the page. I have written it before, but I have never paid attention to it. I have summarized it today, hoping to give you some help and also help me summarize the knowledge I have learned and used before.2008-12-12Practical javascript script for more practical checkboxes
More practical javascript scripts for checkboxes...2007-09-09By default, let the first control of the page select the javascript code
When a form is displayed on the page, the focus is usually not on the first control, and only a little bit of the usual script can achieve this effect.2009-12-12Let ad codes no longer affect your web page loading speed
Let the ad code no longer affect your web page loading speed...2006-07-07