Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


adding column numbers



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
decren



Joined: 07 Apr 2007
Posts: 4
Location: MS

PostPosted: Tue Apr 17, 2007 2:38 pm    Post subject: adding column numbers Reply with quote

Hello,
I have a table with an add-row setup. The table has several columns but I only need to calculate COLUMN FOUR. The results go to a textbox via a button. My code is.....

Code:
function sumup() {
 document.getElementById("Table1")
  column = document.getElementsByTagName("colFour");
  document.myForm.tbTotal.value = column;
}

.....
Code:
<TABLE NAME="Table1" id="Table1">
<COL WIDTH=10*>
   <COL WIDTH=139*>
   <COL WIDTH=27*>
   <COL WIDTH=29*>
   <COL WIDTH=27* NAME="colFour" id="colFour">
   <COL WIDTH=10*>

.....
Code:
<INPUT TYPE=TEXT NAME="tbTotal">
<INPUT TYPE=BUTTON NAME="pbTest" VALUE="TEST" onclick="sumup();"./>

.....But when I click pbTest, the result in tbTotal is, with the brackets.....
[object]
.....What am I doing wrong?
Back to top
View user's profile Send private message Visit poster's website
kroyce



Joined: 17 Apr 2007
Posts: 4

PostPosted: Tue Apr 17, 2007 7:33 pm    Post subject: your column variable is an element object with properties Reply with quote

However, the values you want are probably textNodes within each cell in the column.

It might be helpful to show the entire html for your table.
Back to top
View user's profile Send private message
decren



Joined: 07 Apr 2007
Posts: 4
Location: MS

PostPosted: Tue Apr 17, 2007 9:45 pm    Post subject: Re: adding column numbers Reply with quote

Instead of Table1 as stated above the actual is Table4 - and the entire page is located at.....

http://www.aaronzjukebox.com/R2CDorder1

You may notice that the column 4 heading is 0 (zero) to prevent conflict while I am trying to figure out this problem, but the actual heading will not be numeric.
Thank you in advance for any assistance that you may offer.
Back to top
View user's profile Send private message Visit poster's website
kroyce



Joined: 17 Apr 2007
Posts: 4

PostPosted: Tue Apr 17, 2007 10:27 pm    Post subject: Re: adding column numbers Reply with quote

After looking at the page, I think you are referring to values that are contained in text boxes in table 3. Each textbox needs an id so you can use the document.getElementById("textboxid").value property. I don't know of any other way to do what you want to do.

In order to make this work you would want to give each textbox an id that is easily accessible by javascript on the fly. id may equal something like sumcolumn_i where i iterates with the number of columns. you could then iterate through the values and add them up.

It looks like you add a row each time you process a record. that is the logical place to add the id to each textbox.

I hope this helps.
Back to top
View user's profile Send private message
decren



Joined: 07 Apr 2007
Posts: 4
Location: MS

PostPosted: Tue Apr 17, 2007 11:05 pm    Post subject: Re: adding column numbers Reply with quote

Thank you for your response. You have given me some food for thought (never looked at referencing to the row number.) I'll let you know how it turns out... and again thanks.
Back to top
View user's profile Send private message Visit poster's website
decren



Joined: 07 Apr 2007
Posts: 4
Location: MS

PostPosted: Sat May 05, 2007 12:39 pm    Post subject: Re: adding column numbers Reply with quote

I want to thank everyone at DEVPPL for their input to this problem. With your help and with a table located at:
http://4umi.com/web/javascript/
I was able to work out a solution. If anyone is interested in (what I believe to be unique) addRow/shoppingCart type form, you are welcome to take what you need from my page (as shown on a previous post to this problem)
Understand though that it is a work in progress so you will have to sift through a lot of garbage to get the scripts to your particular need.
And thanx again
Back to top
View user's profile Send private message Visit poster's website
kroyce



Joined: 17 Apr 2007
Posts: 4

PostPosted: Mon May 07, 2007 1:49 pm    Post subject: Solution Reply with quote

Nice, concise solution. Thanks for sharing. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap