Javascript - headers == undefined in a tabular form...

Hi All,
I have a snippit of my html from View Source:

I am try to access the 3565 which is one of the values in a tabular report. I want to get all the amounts in form.

<td headers="CMT_OPTION_000" class="t2data"><input type="hidden" name="f47" value="Option 1" />Option 1</td><td align="right"  headers="Price NetVision Member_000" class="t2data">3565</td>

I tried using:
   var tds = document.getElementsByTagName('td');
   for (var i=0; i<tds.length; i++) {
Then I was going to get the innerHTML
BUT the alert shows undefined
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?
Or more correctly:

Try changing the alert line to:
BILL CarlisleAPEX DeveloperAuthor Commented:
Actually the alert(alltds[j].headers); worked fine... it was something else in my syntax..
Thanks for the help..

Incase anyone needs to use headers:

var alltds = theTable.getElementsByTagName('td');
  var Option1row = false;
  for(var j=0;j<alltds.length;j++){ // for alltds
     if (alltds[j].headers=="CMT_OPTION_000"){ //if my headers
       var elemAllC = alltds[j].getElementsByTagName('input');
       // Check the only 'input' element in the 'td'
       if(elemAllC[0].value=='Option 1'){
     } //if my headers

     if(!Option1row){ //(!Option1row)
       if (alltds[j].headers=="Price NetVision Member_000"){
          // Get the Row that we are in
          var theRow = html_CascadeUpTill(alltds[j],'TR');  
          // Get all the input elements in that Row.
          var elemAll = theRow.getElementsByTagName('input');

          // Go through all 'input' elements to assign Original Value
          for(var b=0;b<elemAll.length;b++){ //elemAll for
             if(elemAll[b].name=="f48"){ //f48
                  var original = elemAll[b].value;
                  //if original is null then innerHTML is the original
                  if (original==''){ //chkorig
                     original = alltds[j].innerHTML;
                     elemAll[b].value = original;
             } //f48
          }//elemAll for
          var newPrice=stripCharsInBag(original,'$');
          newPrice=stripCharsInBag(newPrice ,',');
          newPrice = parseFloat(newPrice)*discountPercentage;
          var strPrice = FormatWithDecimals(newPrice,2);
          alltds[j].innerHTML = '$'+strPrice;
       } // if Price
     } //(!Option1row)
   }  // for LOOP alltds
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.