How to get the value of multiple input boxes with the same name in JS

Source: Internet
Author: User
This article mainly introduces how to implement the input password input box based on JS Code to change the input password to black-dot ciphertext, and how JS can obtain the values of multiple input boxes with the same name. The code is easy to understand and very good, it has reference value. If you need it, please refer to the following to see how to implement the input password Text Box Based on JS Code and change the input password to black-dot ciphertext. The Code is as follows:

Html code

 

Js Code

Function checkForm () {var input_pwd = document. getElementById ('input-password'); var md5_pwd = document. getElementById ('md5-password'); // convert the plaintext entered by the user to md5: md5_pwd.value = toMD5 (input_pwd.value); // proceed to the next step: return true ;}

Supplement: JS obtains the values of multiple input boxes with the same name.

The document is used at first. all. id. length to get the number of input boxes, but sometimes normal, sometimes show undefined, the effect is not very good, online information said document. all is not compatible with all browsers. Now it seems that only Internet Explorer is supported.

The solution is as follows:

Var els = document. getElementsByName ("search"); for (var I = 0, j = els. length; I <j; I ++) {alert (els [I]. value );}

The above is a small series of JS Code for you to implement the input password input box, enter the password to change the blacklist ciphertext, I hope to help you, if you have any questions, please leave a message, the editor will reply to you in a timely manner. I would like to thank you for your support for PHP chinnet!

For more information about how to use JavaScript to obtain the values of multiple input boxes with the same name, see PHP!

Related Article

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.