| |

VerySource

 Forgot password?
 Register
Search
View: 26|Reply: 3

The name attribute is a number. . .

[Copy link]

1

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-2-15 13:00:01
| Show all posts |Read mode
Recently, I have encountered a strange problem when changing other people's programs. There is a SELECT but the NAME attribute is generated by the program loop. The variable is INT, so a number such as 0 is generated. VALUE can be obtained through the request object, but I want to use document.form1 now. 0.value way to get the value of this SELECT !!
Reply

Use magic Report

0

Threads

28

Posts

17

Credits

Newbie

Rank: 1

Credits
17

 China

Post time: 2020-4-15 17:00:01
| Show all posts
document.form1.elements ["selectName"]. options [document.form1.elements ["selectName"]. selectedIndex] .value
Reply

Use magic Report

0

Threads

28

Posts

17

Credits

Newbie

Rank: 1

Credits
17

 China

Post time: 2020-4-15 17:45:02
| Show all posts
btw: It is better not to use names starting with numbers
Reply

Use magic Report

0

Threads

26

Posts

16

Credits

Newbie

Rank: 1

Credits
16

 China

Post time: 2020-4-15 19:15:01
| Show all posts
..........................
id, name cannot start with a number
You can add a1 a2 a3 a4 in front of the number conversion
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list