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


Groups > comp.lang.javascript > #13340

Re: How to Pass variable name to a function

Newsgroups comp.lang.javascript
Subject Re: How to Pass variable name to a function
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <4F85B0AE.A1E9FFD8@erols.com>
Message-ID <XnsA032ED5C429F3eejj99@194.109.133.133> (permalink)
Date 2012-04-11 21:20 +0000

Show all headers | View raw


Stan Weiss wrote on 11 apr 2012 in comp.lang.javascript:

> <INPUT NAME="VD" SIZE=7  onChange="save(stanForm.VD.value,
> AInput, 'Valve Diameter')">
> 

for "stanForm.VD.value" use:

"this.value"

and if you cannot use "this", 
because you are calling from another element in the same form use:

"this.form.elements.VD.value"

and if you are calling from outside such form, use:

"document.forms.stanForm.elements.VD.value"

Why?

Because only in IE an element name 
is dangerously misused as an element pointer.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next 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