Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #25966
| From | "Mel Smith" <syntel@cox.net> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | My 'actual' code |
| Date | 2014-10-21 11:20 -0600 |
| Message-ID | <caniujFef23U1@mid.individual.net> (permalink) |
| References | <calc4vFrm5iU1@mid.individual.net> <can8usFboljU1@mid.individual.net> |
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
<snipped about 60 lines about in this func>
//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<allrows.length;j++) {
rowcells = allrows[j] ;
rowstrval = "" ;
for (i=1;i<numcells;i++) {
if (i === 10) continue ;
cellobj = rowcells[i].firstChild ;
cellid = cellobj.id ;
cellval = getobj(cellid).value ;
if (empty(cellval)) cellval = "X" ;
// do work on building a string here
if (i > 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
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-20 15:11 -0600
Re: JS Array problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-20 22:25 +0000
Re: JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-21 08:33 -0600
Re: JS Array problem danca <cyberdanny@tiscalinet.it> - 2014-10-21 09:08 +0200
Re: JS Array problem Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-21 09:42 +0200
Re: JS Array problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-10-21 09:47 +0200
Re: JS Array problem Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-21 09:51 +0200
Re: JS Array problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-10-21 09:53 +0200
Re: JS Array problem Une Bévue <unbewusst.sein@fai.invalid> - 2014-10-21 09:52 +0200
Re: JS Array problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-10-21 10:36 +0200
Re: JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-21 08:36 -0600
Re: JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-21 08:35 -0600
Re: JS Array problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-21 19:02 +0200
Re: JS Array problem "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-10-21 13:12 +0200
Re: JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-21 08:38 -0600
Re: JS Array problem "Mel Smith" <syntel@cox.net> - 2014-10-21 08:29 -0600
My 'actual' code "Mel Smith" <syntel@cox.net> - 2014-10-21 11:20 -0600
Re: My 'actual' code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-10-21 19:52 +0100
Re: My 'actual' code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-10-21 21:23 +0200
Re: JS Array problem Violet Deng <dengviolet@gmail.com> - 2014-10-28 02:03 -0700
Re: JS Array problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-10-28 10:08 +0100
csiph-web