Javascript-based automated form filling-Example Analysis-javascript skills

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.