[thelist] JavaScript -- calculating & printing

lon.kraemer lwkraemer at earthlink.net
Mon Apr 9 17:01:39 CDT 2001


Oops. Yes the form name will have to be passed to the function as written.

----- Original Message -----
From: "lon.kraemer" <lwkraemer at earthlink.net>
To: <thelist at lists.evolt.org>
Sent: Monday, April 09, 2001 2:24 PM
Subject: Re: [thelist] JavaScript -- calculating & printing


> Actually, there is a reasonable way to handle this using your
processData()
> function. Rather than calling it as a form submission function (you used
> onclick at the button, I prefer onsubmit at the form), simply add:
>
> onfocus="this.value=0;select()" onblur="processData()" [no function
> parameter]
>
> to each of the inputs. This will recalculate the entire form each time
> something is changed.
>
> Whadaya think?
> ------------------------
> Lon Kraemer
> Web Design/ASP Development
> http://www.lkraemer.com
> --------------------------------------------
>
> ----- Original Message -----
> From: "Luther, Ron" <Ron.Luther at COMPAQ.com>
> To: <thelist at lists.evolt.org>
> Sent: Monday, April 09, 2001 2:01 PM
> Subject: RE: [thelist] JavaScript -- calculating & printing
>
>
> > Hi Lon,
> >
> >
> > Good catch! ... (Yeah - I noticed that ... it didn't bother me enough to
> > look too deeply at - the behavior is consistent ... if you fill in both
> ...
> > metric is assumed to be your 'real' input.... and things trundle along.)
> >
> > Does that make this a "training" issue rather than a "coding" issue?
<he
> > says (with a very small dose of seriousness for this 'project'- but
> perhaps
> > not for some others) and ducks quickly>
> >
> > I like the radio button idea though .... and I've seen a JS calculator
> > somewhere that I think used a drop-down to let you select any one of 40
or
> > so different conversions - one input, one output - and a whole lot
> > "prettier"!
> >
> > I'm sure the "quickie" I threw up has more flaws than that ... but 'user
> > interface design and ease of operability' are worthwhile issues for any
> size
> > site! [even a single page] ... Basically it's a design issue that would
> have
> > to be negotiated with the client - finding the 'easiest', 'clearest' and
> > 'most intuitive' design.... which could very well not be the one here!
> >
> >
> > Lauri's note on the "precision problem" bugged me more.  [It gets even
> > 'cooler' - since different browser versions return different values in
the
> > last digit to the right!  {lifted from a quick look at Danny Goodman's
> > JavaScript Bible}]  Welcome to floating point headaches!
> >
> > While I didn't have time to fix it yet ... phone calls and work getting
in
> > the way  ;-) ... I suspect that working with the input as a string,
> parsing
> > the number of places entered, and applying a "smart" rounding function
> could
> > do a better job.
> >
> >
> > Lauri's last question - "What do you really do?" might be a cool thread
on
> > thechat ... since not all of us develop public sites ... or even work in
> IT!
> >
> >
> > RonL.
> >
> > -----Original Message-----
> > Lauri,
> >
> > Even Ron's sample demonstrates a basic flaw. What if the user fills in
> BOTH
> > metric and imperial for a given dimension. How do you know which one was
> > intended?
> >
> > I'm inclined to suggest using a radio select for type (meters or feet),
> then
> > inputs for the appropriate measurements... using Ron's calculator
> functions.
> > Of course they couldn't mix units once the radio was selected!
>
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list