D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Some help with javascript & firefox

 



Julian Hall wrote:
Kevin Lucas wrote:
  
I have edited the loop but still get only the literal string "sum += 
parseInt( document.splitfm.vat_low3.value " as an input to the box  
low_vattot
what do I need to convert this to the .value?
    
Ahh.. penny has dropped... I think.

Steven may correct me if I'm wrong on this but IIRC _javascript_ evaluates 
symbols thus:

== (double =) means 'this is the content of'
=  means 'this is the result of'

Not sure if that makes linguistic sense so here's an example:

a = 2 + 4  result - a = 6

a== 2+4  result - a is a string '2+4'

In other words I think you may have a == where you want a =, or vice versa.

Also, it may be the single quotes around the _expression_ telling the 
script to enclose the lot in a string;

vat_low = 'sum += parseInt( document.splitfm.vat_low' + i + '.value )';

Try:

vat_low = sum += parseInt( document.splitfm.vat_low' + i + '.value );

I notice as well that vat_low isn't given an initial value, so the 
script may assume it's a string and not be calculating the value as a 
mathematical value, but concatenating it as a string.

Kind regards,

Julian

  
I get
missing ) after argument list
http://192.168.0.30/oldsplitaddtable.html
Line 37

--
Regards: Kevin Lucas Post Master (Sub) Minions Shop & Tea Rooms Minions Liskeard Cornwall PL14 5LE www.minionsbandb.co.uk
-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html