AW: AW: AW: [Javascript] addin <input fields> via visibility orsimilar?
Julien Nadeau
junado at junado.com
Mon Sep 26 15:31:57 CDT 2005
I suggest you do something like this:
replace:
if (inputFields[i].getAttribute("name") == "products_id[]
[products_quantity]") {
with:
if (inputFields[i].getAttribute("name").substring(0,11) ==
"products_id") {
This will scan for fields where the attribute "name" starts with
"products_id".
Julien Nadeau
junado at junado.com
Le 05-09-26 à 08:14, Michael Borchers a écrit :
> >
> function countRows() {
> var orderNumRows = 0;
> var inputFields = document.getElementsByTagName("input")
> var numTag = inputFields.length;
> for (i=0; i<numTag; i++) {
> if (inputFields[i].getAttribute("name") == "test[]") {
> orderNumRows++;
> }
> }
>
> alert(orderNumRows);
> }
>
> <<<
>
> ok, now my input's name is products_id[X][products_quantity], while
> X is the position in array.
> regarding your function mine should look like this, or?
>
> function countRows() {
> var ordersNumRows = 0;
> var inputFields = document.getElementsByTagName("input")
> var numTag = inputFields.length;
> for (i=0; i<numTag; i++) {
> if (inputFields[i].getAttribute("name") == "products_id[]
> [products_quantity]") {
> ordersNumRows++;
> }
> }
>
> alert(ordersNumRows);
> }
>
> or do i need to add the X within "products_id[" + i + "]
> [products_quantity]"?
>
> and how can i make it work for selects? just change
> document.getElementsByTagName("select")?
> thanks!
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20050926/db4d956f/attachment.htm>
More information about the Javascript
mailing list