Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12332
| From | Dr J R Stockton <reply1209@merlyn.demon.co.uk> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Cant use <input text as a numeric |
| Date | 2012-03-01 20:52 +0000 |
| Organization | Home |
| Message-ID | <pvoVyQMVG+TPFw4D@invalid.uk.co.demon.merlyn.invalid> (permalink) |
| References | (3 earlier) <ji944q$8p3$1@dont-email.me> <2271012.FRqVoOGUtd@PointedEars.de> <ji9clr$oeh$1@dont-email.me> <XnsA0046458823CFeejj99@194.109.133.133> <lgunk7p817n3bqiap7ud9g9t9sdvkcsvqt@4ax.com> |
In comp.lang.javascript message <lgunk7p817n3bqiap7ud9g9t9sdvkcsvqt@4ax.
com>, Mon, 27 Feb 2012 13:49:28, Gene Wirchenko <genew@ocis.net> posted:
>
> ISTM that I have seen examples -- was it CSS? -- where an id was
>used repeatedly to have an effect applied in more than one place.
On a reasonably modern computer, say less than a decade old, and with a
page that is not unreasonably big and complex, one can recursively scan
the whole of the DOM tree in a sufficiently short time. One can use any
indicator to show which elements need to be changed, with the (sole?)
exception of the .id property value itself, which must be unique.
The class property is ideal, if what one wants can be done by CSS : the
mechanism is already there.
But one can, instead of putting ID=Shibboleth on multiple elements,
which is sinful but may be (unreliably) harmless if that ID is not
otherwise used, use ID=Shibboleth000, ID=Shibboleth001,
ID=Shibboleth002, ..., ID=Shibboleth999 and scan for IDs which start
with Shibboleth.
It may be that the required places have only certain "Tag"s; in that
case it may be faster to use document.getElementsByTagName and scan what
is found for appropriate IDs. I call the following function onload in
almost any of my pages that uses JavaScript, to put a grey background on
almost all read-only elements :
function ReadOnly() {
function Do(Str) { var K=0, Elems, Elem
Elems = document.getElementsByTagName(Str)
while (Elem=Elems[K++])
if (Elem.readOnly && Elem.className!="NAY")
Elem.style.background = "#F0F0F0" }
Do("input") ; Do("textarea") }
// H'mmm - I have now no NAY classes !
IDs must be unique; but they do not need to be very unique.
If the set of elements is to be changed repeatedly, one should use a
single initial scan and note the references in a suitable data
structure, such as an array or a linked list.
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike 6.05 WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-24 14:32 -0500
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-24 16:54 -0500
Re: Cant use <input text as a numeric Denis McMahon <denismfmcmahon@gmail.com> - 2012-02-24 22:34 +0000
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-24 17:48 -0500
Re: Cant use <input text as a numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-25 00:33 +0100
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-24 20:14 -0500
Re: Cant use <input text as a numeric "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-25 08:51 +0000
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-25 09:25 -0500
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-27 13:49 -0800
Re: Cant use <input text as a numeric "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-27 22:06 +0000
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-27 17:00 -0800
Re: Cant use <input text as a numeric John G Harris <john@nospam.demon.co.uk> - 2012-02-28 10:46 +0000
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-28 12:45 -0800
Re: Cant use <input text as a numeric "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-28 23:33 +0000
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-28 17:04 -0800
Re: Cant use <input text as a numeric "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-29 09:11 +0000
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-29 14:07 -0800
Re: Cant use <input text as a numeric "Evertjan." <exjxw.hannivoort@interxnl.net> - 2012-02-29 22:23 +0000
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-29 16:04 -0800
Re: Cant use <input text as a numeric Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2012-02-28 01:58 +0100
Re: Cant use <input text as a numeric Gene Wirchenko <genew@ocis.net> - 2012-02-27 21:31 -0800
Re: Cant use <input text as a numeric Dr J R Stockton <reply1209@merlyn.demon.co.uk> - 2012-02-28 21:41 +0000
Re: Cant use <input text as a numeric Dr J R Stockton <reply1209@merlyn.demon.co.uk> - 2012-03-01 20:52 +0000
Re: Cant use <input text as a numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-25 13:12 +0100
Re: Cant use <input text as a numeric Denis McMahon <denismfmcmahon@gmail.com> - 2012-02-25 04:36 +0000
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-25 09:13 -0500
Re: Cant use <input text as a numeric Denis McMahon <denismfmcmahon@gmail.com> - 2012-02-25 04:41 +0000
Re: Cant use <input text as a numeric Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-25 13:13 +0100
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-25 09:17 -0500
[OT] Quoting style (was: Cant use <input text as a numeric) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-27 17:52 +0100
Re: Cant use <input text as a numeric " Cal Who" <CalWhoNOSPAM@roadrunner.com> - 2012-02-25 09:15 -0500
Re: Cant use <input text as a numeric Dr J R Stockton <reply1208@merlyn.demon.co.uk> - 2012-02-25 21:00 +0000
csiph-web