基本数组的东西 [英] Basic array stuff
问题描述
这是基本的,我用Google搜索但没有找到太多帮助。
我有一个文本元素字段数组。他们都需要具有相同的
名称。所以,让名字全部用[]或单独构建为
a [0],[1],[2]等等。括号需要在那里,因为我会
在PHP中使用$ _POST {''a'']获取它们的值作为数组。
我想做的是在javascript中设置个人的价值
元素,比如a [3]。我尝试了很多组合
1 - 将所有ID设置为
a)a
b)a []
c)单独作为[0],[1]等。
2 - 使用document.getElementById
3 - 使用document.getElementsByName
任何时候我从名称创建和反对,然后尝试使用那个
对象,我得到对象没有属性在Firebug中。这是真的
我是否尝试obj.value或obj [i] .value。
所以,请,
1 - 如何设置id属性?
2 - 如何在阵列中访问或设置单个成员?
3 - 对于name属性,我应该使用a []或单独构建它们
或者就javascript而言无关紧要?
是的,这是基本的,但我一直在现在几个小时在圈子里
所以任何帮助都将受到赞赏。
This is kind of basic, and I googled but didn''t find much help.
I have an array of text element fields. They all need to have the same
name. So, let the name be either all with a[] or build individually as
a[0], a[1], a[2], etc. The brackets need to be there because I will
obtaining the values of them as an array using $_POST{''a''] in php.
What I want to do is in javascript set the value of an individual
element, say a[3]. I have tried many combinations of
1 - setting the ids all as
a) a
b) a[]
c) individually as a[0], a[1], etc.
2 - using document.getElementById
3 - using document.getElementsByName
Any time I create and object from the name, and then try to use that
object, I get "object has no properties" in Firebug. This is true
whether I try obj.value or obj[i].value.
So, please,
1 - How do I set the id attribute?
2 - How do I access or set an individual member in the array?
3 - For the name attribute, should I use a[] or individually build them
or does it not matter as far as javascript is concerned?
Yes, this is basic, but I have been going in circles for a few hours now
so any help will be appreciated.
推荐答案
_POST {''a''在PHP中。
我想要做的是在javascript中设置个人的价值
元素,比如说[3]。我尝试了很多组合
1 - 将所有ID设置为
a)a
b)a []
c)单独作为[0],[1]等。
2 - 使用document.getElementById
3 - 使用document.getElementsByName
任何时候我从名称创建和反对,然后尝试使用那个
对象,我得到对象没有属性在Firebug中。这是真的
我是否尝试obj.value或obj [i] .value。
所以,请,
1 - 如何设置id属性?
2 - 如何在阵列中访问或设置单个成员?
3 - 对于name属性,我应该使用a []或单独构建它们
或者就javascript而言无关紧要?
是的,这是基本的,但我一直在现在几个小时在圈子里
所以任何帮助都将受到赞赏。
_POST{''a''] in php.
What I want to do is in javascript set the value of an individual
element, say a[3]. I have tried many combinations of
1 - setting the ids all as
a) a
b) a[]
c) individually as a[0], a[1], etc.
2 - using document.getElementById
3 - using document.getElementsByName
Any time I create and object from the name, and then try to use that
object, I get "object has no properties" in Firebug. This is true
whether I try obj.value or obj[i].value.
So, please,
1 - How do I set the id attribute?
2 - How do I access or set an individual member in the array?
3 - For the name attribute, should I use a[] or individually build them
or does it not matter as far as javascript is concerned?
Yes, this is basic, but I have been going in circles for a few hours now
so any help will be appreciated.
On Sun,2008年10月5日15:38:49 -0400 ,sheldonlg< sheldonlgwrote:
On Sun, 05 Oct 2008 15:38:49 -0400, sheldonlg <sheldonlgwrote:
>这是基本的,我用Google搜索,但没有找到太多帮助。
我有一个文本元素字段数组。他们都需要具有相同的名称。所以,让名字全部用[]或单独构建为
a [0],[1],a [2]等。括号需要在那里因为我会
在php中使用
>This is kind of basic, and I googled but didn''t find much help.
I have an array of text element fields. They all need to have the same
name. So, let the name be either all with a[] or build individually as
a[0], a[1], a[2], etc. The brackets need to be there because I will
obtaining the values of them as an array using
_POST {''a'']获取它们的值作为数组。
我想要做的是在javascript中设置值个人的元素,比如说[3]。我已经尝试了很多组合的
1 - 将所有的ID设置为
a)a)b)a []
c)单独作为[0], a [1]等。
2 - 使用document.getElementById
3 - 使用document.getElementsByName
每次我从名称创建和对象,然后尝试使用那个
对象,我得到对象没有属性在Firebug中。这是真的
我是否尝试obj.value或obj [i] .value。
所以,请,
1 - 如何设置id属性?
2 - 如何在数组中访问或设置单个成员?
3 - 对于name属性,我应该使用[]还是单独构建它们
或者就javascript而言无关紧要是关注?
是的,这是基本的,但我已经在圈子里进行了几个小时
所以任何帮助将不胜感激。
_POST{''a''] in php.
What I want to do is in javascript set the value of an individual
element, say a[3]. I have tried many combinations of
1 - setting the ids all as
a) a
b) a[]
c) individually as a[0], a[1], etc.
2 - using document.getElementById
3 - using document.getElementsByName
Any time I create and object from the name, and then try to use that
object, I get "object has no properties" in Firebug. This is true
whether I try obj.value or obj[i].value.
So, please,
1 - How do I set the id attribute?
2 - How do I access or set an individual member in the array?
3 - For the name attribute, should I use a[] or individually build them
or does it not matter as far as javascript is concerned?
Yes, this is basic, but I have been going in circles for a few hours now
so any help will be appreciated.
将问题发布到comp.lang.javascript。
这个组是关于基本的html。
Pleast post question to comp.lang.javascript.
This group is about basic html.
这篇关于基本数组的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!