PDA

View Full Version : Passing Variable



kathycam
06-13-2012, 11:23 PM
http://enviroflexsurfaces.com/wp-content/themes/ecobiz/sample.png

I have created a dynamic table (see attached).
I have set the name of each column to an array.
The last column called "TOT" is what I need to work with:
<td><input type="text" name="TOT[]" size="3" maxlength="6"></td>

When you click the "AA" hyperlink, I need the Sub Total input textbox to be set with the total of all values in the TOT array. Right now I can't even get it to display anything at all, much less total.

Here is my javascript:
<script type="text/javascript">
function CalculateSubTotal(TOT)
{
for(var i=0;i<TOT.length;i++)
{
alert(TOT[i]);
}
}
</script>

Here is the href where I call this function:
<a href="javascript:CalculateSubTotal(TOT);">AA</a>



Thanks.

ApacheTech
06-13-2012, 11:58 PM
Can you please provide us with the mark up for the page, a link to the page live online, or an attachment of a file containing the source code.

If placing code within your post, can you please use the
or
tags provided in the editor to wrap your code in. This will preserve any indentation and add syntax highlighting to your code in the post.

kathycam
06-14-2012, 12:06 AM
Hi

Here is a link to my code:
http://enviroflexsurfaces.com/wp-content/themes/ecobiz/sample.php