On Sep 12, 5:10 am, Daniel Lopes <[EMAIL PROTECTED]> wrote:
> Thanks Diogo... this fix my problem:
>
> function check_entries(){
> sum = 0;
> $$("#entries_list input:checked").each( function(e) {
> value = $("value_"+$(e).id).innerHTML;
> value = currency_to_float(value);
> sum += parseFloat(value);
> });
> alert(sum);
>
> }
>
> function currency_to_float(value){
> value = value.gsub(/[R$.)]/, '') ;
> value = value.gsub(/,/, '.');
> value = value.gsub(/(/,'-');
> return value
>
> }
>
An approach I have used is something like
$$("#entries_list input:checked").each( function(e) {
var value = e.up('tr').down('.value').firstChild.value;
Since you are using their position in the DOM tree, you don't have to
worry about setting the right id on the value TD's.
Colin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---