The example in this article describes how JavaScript gets and changes the input label Name property. Share to everyone for your reference. The implementation methods are as follows:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16-17 |
<input name= "KK" ></input> <script language= "JavaScript" >//Here Use getElementsByTagName to remove all input objects ,//This is the critical place for this problem, with bytagname rather than byname. var list = document.getElementsByTagName ("input"); Follow the bad collection, including all input. var inputlist = document.getelementsbyname ("KK"); Test for (i=0;i<list.length;i++) {//Here is the pop-up is ' KK ', of course, can also output other according to need. For example: list[i].id; List[i].value and so on. alert (list[i].name);//This is to modify this value List[i].name = ' mm ';//Then the pop-up is ' mm ' alert (list[i].name); } </script> |
I hope this article will help you with your JavaScript programming.