This article mainly introduces how to implement automatic form filling in javascript, and analyzes the related skills of JavaScript in combination with browser settings in the form of a simple example, for more information about how to use javascript to automatically enter a form, see the example in this article. We will share this with you for your reference. The details are as follows:
When many forms are frequently filled in during normal development or when accessing some sites, we can use javascript to write a script and prepare the information to be filled in advance, then, simulate the button action and automatically submit the form, which is easy and efficient.
Procedure
1. Find the corresponding form on the page and list the html controls required by the form, as shown in figure
2. Compile js Code
The Code is as follows:
Javascript: customersForm. thisFnameField. value = "Zhang"; customersForm. thisLnameField. value = "3"; customersForm. thisCompanyField. value = "company"; customersForm. thisAddressField. value = "China"; customersForm. submit. focus ();
3. The third step is the most important, because people with a little js knowledge in the first two steps will write such simple code. The next step is to use the favorites (bookmarks) function of the browser to store js Code.
Take chrome as an example. Right-click the bookmarks and choose "add webpage". Enter "auto-fill form" as the name, enter the "above js Code" as the URL, and save it.
4. Test it.
Open the corresponding page in the browser, and click automatically fill in the table in the Bookmarks Bar, you will be surprised to find that the table has been filled.
I hope this article will help you design JavaScript programs.