Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Mel Smith" Newsgroups: comp.lang.javascript Subject: My 'actual' code Date: Tue, 21 Oct 2014 11:20:04 -0600 Lines: 91 Message-ID: References: X-Trace: individual.net ifPuO4TODZpsAfnBW/AKLQk02eVJ/kvV9DxcftmwmcuaVytC1/ Cancel-Lock: sha1:P++KlyPJ5V219UFA8dilN5YpiSc= X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: csiph.com comp.lang.javascript:25966 Hi All: FYI, below is the actual code I'm currently working on. I've included Danca's Eval() code suggestions and thought about Evertjan's improvement. btw, it works great ! Also, I'll be examining Thomas Lahn's other suggestions this afternoon. In my 'for' loops, I usually pre-calc the length instead of using .length in the header). I didn't bother this time but will change it later. Thanks to all -Mel //vars i,j are local vars from above of course // the values I'm gathering are single-char values in a 5 row, 23 column input table, where there are only 18 input elements in each row. // As the user inputs single values, he is 'kicked' to the next element (either verticall or horizontally), and the read-only fields in tge row are updated // there will be five (for now) strings submitted to the server - one string from each row ************************** // now have to code the table for all internal values var hscells,ptcells,ftcells,dlcells,rlcells ; var hsstr,ptstr,ftstr,dlstr,rlstr ; hsstr = ptstr = ftstr = dlstr = rlstr = "" ; hscells = getobj("ihsrow").cells ; ptcells = getobj("iptrow").cells ; ftcells = getobj("iftrow").cells ; dlcells = getobj("idlrow").cells ; rlcells = getobj("irlrow").cells ; var allrows = [hscells,ptcells,ftcells,dlcells,rlcells] ; var allstrs = ["hsstr","ptstr","ftstr","dlstr","rlstr"] ; // could use .split() maybe var rowcells,rowstrval ; var numcells = hscells.length ; // each row has same number of cells var cellobj,cellid,cellval ; for (j=0;j 19) break ; rowstrval += cellval +"^" ; } // select string reference and place composite value in it // next is suggestion by Dan and later Evertjan from my JS ng on Oct 21/14 eval(allstrs[j] + '= "' + rowstrval+'"') ; } // testing code here alert("hsstr="+hsstr) ; alert("ptstr="+ptstr) ; alert("ftstr="+ftstr) ; alert("dlstr="+dlstr) ; alert("rlstr="+rlstr) ; // much more to be done but ... return false ; // for now ... // much more work to be done below