Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: Re: How to get table row addressibility


Message #1 by "Robert Nyman" <robert.nyman@c...> on Wed, 20 Nov 2002 14:53:57 +0100
I think Joe wrote too fast...
It's supposed to be:

var oTable =3D document.getElementById("Payees");


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: Peter N. Kipe [mailto:pkipe@c...]
Skickat: den 19 november 2002 20:36
Till: javascript
=C4mne: [javascript] Re: How to get table row addressibility


Joe,

IE6 didn't like oTable.rows.length, so I hard coded a number of rows.
Also, I changed "getElementByTagName" to getElementsByTagName" -- plural
Elements. I assume it was just a typo.

But when I run the script,

      function ApplyPending()
       {var oTable =3D document.getElementsByTagName("Payees");
        for (var i =3D 0; i < 5; i++)
         {if (oTable.rows[i].cells[1].innerHTML =3D=3D "Pending")
           {oTable.rows[i].cells[1].innerHTML =3D "";}
         }
       }
      //-->

I get the message Error: 'rows' is null or not an object.

Any ideas?

Pete

-----Original Message-----
From: Joe Fawcett [mailto:joefawcett@h...]
Sent: Tuesday, November 19, 2002 12:17 PM
To: javascript
Subject: [javascript] Re: How to get table row addressibility






We meet again Mr. Kipes...
If you wish to be 'compliant' and 'Payees' is the id of your table then
it's:
var oTable =3D document.getElementByTagName("Payees");
for (var i =3D 0; i < oTable.rows.length; i++)
{
  if (oTable.rows[i].cells[1].innerHTML =3D=3D "Pending")
  {
    oTable.rows[i].cells[1].innerHTML =3D "";
  }
}

If you're not bothered and it's IE just use 'Payees':
for (var i =3D 0; i < Payees.rows.length; i++)
{
  if (Payees.rows[i].cells[1].innerHTML =3D=3D "Pending")
  {
    Payees.rows[i].cells[1].innerHTML =3D "";
  }
}

Joe

>From: "Peter Kipe" <pkipe@c...>
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] How to get table row addressibility
>Date: Tue, 19 Nov 2002 17:07:45
>
>In the following function, I need to access the second cell of each row

>of a table.  What is the correct .rows property?
>
>   function ApplyPending()
>    {for (var i =3D 0; i<Payees.length; i++)
>      {if (document.Payees.rows[i].cells[1].innerHTML =3D=3D "Pending")
>       {document.Payees.rows[i].cells[1].innerHTML =3D "";}
>      }
>    }
>
>Thanks,
>
>Pete
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or to
>unsubscribe send a blank email to 
[1]

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=3Dfeatures/featuredemail


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 




  Return to Index