Javascript Traversal page Text control detailed

Source: Internet
Author: User

  This article is mainly on the JavaScript traversal page text control is introduced, the need for friends can come to the reference, I hope to be helpful to everyone

The following function implements the control ID     code that lists all HTML control type text in the page as follows:         function texts ()       &NBS P   {               //var els= document.getelementsbytagname ("*");  //els Get page All controls                var els= document.getelementsbytagname ("INPUT"); The above can also be reduced to cycle                var msgs= "";          &NBS P      for (var i=0;i<els.length;i++)                {  &nbs P                if (els[i].type = "text")           &NBS P        {                       //get control ID&NB Sp                      MSGS = els[i].id + ",";      & nbsp            }               }          &NB Sp    alert (msgs);          &NBSP}  

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.