[color=red]只有html中的name属性标识的域的值,才能被服务器端接收[/color]
原文链接
[url]
http://nadeeth.info/blog/node/20[/url]
Difference between HTML id and name attributes
Published
by
nadeeth
on Mon, 10/20/2008 - 11:16
* nadeeth's blog
[color=red][size=xx-large]Everybody knows that values that pass to the server using HTML forms are accessed by the ‘name' attribute.[/size][/color] What I am going to write here is not related to that server side form handling. Consider the DOM functions given below document.getElementById() and document.getElementsByName(). Using the first one (getElementById), you can access a one element uniquely. That means if you want to identify one single element uniquely you should use the id property. On the other hand, using second function (getElementsByName) you can get an array of elements that have the same name. No matter although there is one element in that particular name, this function returns an array. Some times, we have to use the same name for more than one element (Ex. Radio button groups, Etc...). After all, the name and id HTML properties are used for different purposes.
原文链接
[url]
http://nadeeth.info/blog/node/20[/url]
Difference between HTML id and name attributes
Published
by
nadeeth
on Mon, 10/20/2008 - 11:16
* nadeeth's blog
[color=red][size=xx-large]Everybody knows that values that pass to the server using HTML forms are accessed by the ‘name' attribute.[/size][/color] What I am going to write here is not related to that server side form handling. Consider the DOM functions given below document.getElementById() and document.getElementsByName(). Using the first one (getElementById), you can access a one element uniquely. That means if you want to identify one single element uniquely you should use the id property. On the other hand, using second function (getElementsByName) you can get an array of elements that have the same name. No matter although there is one element in that particular name, this function returns an array. Some times, we have to use the same name for more than one element (Ex. Radio button groups, Etc...). After all, the name and id HTML properties are used for different purposes.