Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13361

Re: How to Pass variable name to a function

From Stan Weiss <srweiss@erols.com>
Newsgroups comp.lang.javascript
Subject Re: How to Pass variable name to a function
Date 2012-04-12 18:54 -0400
Organization Aioe.org NNTP Server
Message-ID <4F875D37.78BE0EBE@erols.com> (permalink)
References <4F85B0AE.A1E9FFD8@erols.com> <Aj8fxRPNfyhPFwNo@invalid.uk.co.demon.merlyn.invalid>

Show all headers | View raw



Dr J R Stockton wrote:
> 
> In comp.lang.javascript message <4F85B0AE.A1E9FFD8@erols.com>, Wed, 11
> Apr 2012 12:26:22, Stan Weiss <srweiss@erols.com> posted:
> 
> >I have this code in a form which calls the save function.
> >
> ><TR><TD ALIGN="RIGHT">
> ><b>Valve Diameter in Millimetres </b>
> ></TD><TD>
> ><INPUT TYPE="text" NAME="VD" SIZE=7  onChange="save(stanForm.VD.value,
> >AInput, 'Valve Diameter')">
> ></TD></TR>
> >
> >function save( field, vary, text ) {
> >     if( isNaN( field ) )
> >     {
> >        alert( text + " is not numeric" );
> >     }
> >     else
> >     {
> >         AInput = eval(field);  // this Works
> >         vary = eval(field);    // this does not workWorks
> >     }
> >}
> >
> >Can anyone see what I am doing wrong?
> 
> Easily :
>   You are not saying which browser you have been using.
>   You have not posted complete working/failing code.
>   You have not reported the output (including "none") of the browser's
>     native, or another, debugger.
>   You've not remembered things said in the newsgroup FAQ.
>   You've not said exactly what you expect, nor what you get - that code
>     works as it should, only your expectations were wrong.
>   And, as a minor detail, your code is wrong.
> 
> To convert a typed input String to a Number, unary + is commonly best;
> neither too liberal nor too rigorous.  For example, AInput = +field .
> Then check that the value of AInput is admissible.
> 
>                                 And, posting from -0400, should you
>                                 be spelling Millimetres correctly ?

There are a few word spelled that way since the original code was
written by someone in
the UK. I am changing the User Interface. Here in the US I would have
used inches. <g> I mean "Atmospheric Pressure Reading in Millibars" or
"Vapour Pressure" <lol>

Stan

> 
> --
>  (c) John Stockton, nr London UK  ?@merlyn.demon.co.uk  IE8 FF8 Op11 Sf5 Cr15
>    news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
>    <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
>    <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-11 12:26 -0400
  Re: How to Pass variable name to a function Andreas Bergmaier <andber93@web.de> - 2012-04-11 19:47 +0200
    Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-11 14:21 -0400
      Re: How to Pass variable name to a function Stefan Weiss <krewecherl@gmail.com> - 2012-04-11 20:53 +0200
        Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-11 15:16 -0400
          Re: How to Pass variable name to a function Gene Wirchenko <genew@ocis.net> - 2012-04-11 15:18 -0700
  Re: How to Pass variable name to a function "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-04-11 21:20 +0000
  Re: How to Pass variable name to a function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-11 23:56 +0200
    Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 00:48 -0400
      Re: How to Pass variable name to a function Andrew Poulos <ap_prog@hotmail.com> - 2012-04-12 15:21 +1000
        Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 02:11 -0400
          Re: How to Pass variable name to a function Andrew Poulos <ap_prog@hotmail.com> - 2012-04-12 18:57 +1000
            Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 09:35 -0400
      Re: How to Pass variable name to a function Stefan Weiss <krewecherl@gmail.com> - 2012-04-12 08:08 +0200
        Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 10:13 -0400
      Re: How to Pass variable name to a function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-12 22:47 +0200
        Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 17:04 -0400
          Re: How to Pass variable name to a function Tim Streater <timstreater@greenbee.net> - 2012-04-12 22:17 +0100
          Re: How to Pass variable name to a function Scott Sauyet <scott.sauyet@gmail.com> - 2012-04-13 05:13 -0700
            Re: How to Pass variable name to a function "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-04-13 16:27 +0000
              Re: How to Pass variable name to a function Scott Sauyet <scott.sauyet@gmail.com> - 2012-04-16 04:11 -0700
        Re: How to Pass variable name to a function "Tom de Neef" <tdeneef@qolor.nl> - 2012-04-12 23:34 +0200
          Re: How to Pass variable name to a function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-04-13 10:03 +0200
          Re: How to Pass variable name to a function Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-04-13 12:03 +0200
            Re: How to Pass variable name to a function Andrew Poulos <ap_prog@hotmail.com> - 2012-04-13 21:35 +1000
            Re: How to Pass variable name to a function Gene Wirchenko <genew@ocis.net> - 2012-04-13 09:00 -0700
  Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 14:03 -0400
  Re: How to Pass variable name to a function Dr J R Stockton <reply1215@merlyn.demon.co.uk.not.invalid> - 2012-04-12 20:06 +0100
    Re: How to Pass variable name to a function Stan Weiss <srweiss@erols.com> - 2012-04-12 18:54 -0400

csiph-web