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


Groups > comp.lang.javascript > #12469

Re: Referring to Controls by id

Newsgroups comp.lang.javascript
Subject Re: Referring to Controls by id
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <191dl7ltuts723trrgoj29mln2b3uvqflk@4ax.com> <4f56ba86$0$2810$a8266bb1@newsreader.readnews.com>
Message-ID <XnsA00F7461D2062eejj99@194.109.133.133> (permalink)
Date 2012-03-07 10:26 +0000

Show all headers | View raw


Denis McMahon wrote on 07 mrt 2012 in comp.lang.javascript:

> On Tue, 06 Mar 2012 14:03:52 -0800, Gene Wirchenko wrote:
> 
>>      I suppose I will just change everything to use
>> document.getElementById(), but the above is shorter.

Indeed, using IE-only code is a bad idea.

But "everything"?

The use of 

document.forms[].elements[].
this.
this.form.
elementPointer.getElementsBy*()

can make live much easier,
as more general functions can be written.

> You could wrap document.getElementById thus:
> function el( id ) { return document.getElementById( id ); }

This function is most commonly named gebi()

-- 
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

Referring to Controls by id Gene Wirchenko <genew@ocis.net> - 2012-03-06 14:03 -0800
  Re: Referring to Controls by id Jeff North <jnorthau@yahoo.com.au> - 2012-03-07 09:23 +1100
    Re: Referring to Controls by id Gene Wirchenko <genew@ocis.net> - 2012-03-06 15:02 -0800
      Re: Referring to Controls by id Jeff North <jnorthau@yahoo.com.au> - 2012-03-07 19:08 +1100
        Re: Referring to Controls by id "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-03-07 10:44 +0200
          Re: Referring to Controls by id Jeff North <jnorthau@yahoo.com.au> - 2012-03-07 23:32 +1100
      Re: Referring to Controls by id Dr J R Stockton <reply1210@merlyn.demon.co.uk> - 2012-03-07 21:26 +0000
  Re: Referring to Controls by id Denis McMahon <denismfmcmahon@gmail.com> - 2012-03-07 01:31 +0000
    Re: Referring to Controls by id Gene Wirchenko <genew@ocis.net> - 2012-03-06 22:33 -0800
      Re: Referring to Controls by id Dr J R Stockton <reply1210@merlyn.demon.co.uk> - 2012-03-08 19:06 +0000
    Re: Referring to Controls by id "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-07 10:26 +0000
      Re: Referring to Controls by id Gene Wirchenko <genew@ocis.net> - 2012-03-07 08:55 -0800
        Re: Referring to Controls by id "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-03-08 09:44 +0000
          Re: Referring to Controls by id Gene Wirchenko <genew@ocis.net> - 2012-03-08 19:26 -0800

csiph-web