Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #12133 > unrolled thread
| Started by | " Cal Who" <CalWhoNOSPAM@roadrunner.com> |
|---|---|
| First post | 2012-02-24 14:32 -0500 |
| Last post | 2012-02-25 21:00 +0000 |
| Articles | 12 on this page of 32 — 9 participants |
Back to article view | Back to comp.lang.javascript
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
Page 2 of 2 — ← Prev page 1 [2]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2012-02-27 21:31 -0800 |
| Message-ID | <skpok797rebk6vb0l3qugulmfp2ta3odeq@4ax.com> |
| In reply to | #12220 |
On Tue, 28 Feb 2012 01:58:59 +0100, Eric Bednarz
<bednarz@fahr-zur-hoelle.org> wrote:
>Gene Wirchenko <genew@ocis.net> writes:
>
>> 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.
>
>ISTM that I have seen examples – was it Colorado? – where communism worked.
> I haven’?t seen many examples of proper indenting of opening pragraphs,
>or en dashes, though. :-)
See my new thread "The onkey* Clause" for an example from a text.
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1209@merlyn.demon.co.uk> |
|---|---|
| Date | 2012-02-28 21:41 +0000 |
| Message-ID | <nHEW4TGloUTPFwaW@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #12216 |
In comp.lang.javascript message <lgunk7p817n3bqiap7ud9g9t9sdvkcsvqt@4ax. com>, Mon, 27 Feb 2012 13:49:28, Gene Wirchenko <genew@ocis.net> posted: >On 25 Feb 2012 08:51:54 GMT, "Evertjan." ><exjxw.hannivoort@interxnl.net> wrote: > >[snip] > >>document.getElementById() can always be used and is quite safe when you >>rmember an id must be unique in html. > > It does? > > 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. It all depends on what is meant by id. One can have as many strings of value "id" as one wants. One can have as many variables with identifier id, all in different scopes, as one wants; and they each can have any value. One can have as many properties named id of any objects you like (though no more than one each) --- except that among the id properties of the elements of the DOM tree at any one time there must not (but can) be any two of the same value - presumably including the value undefined. The average programmer of commercial web pages, who is undoubtedly of low intelligence, can be advised to put a different id on every element that needs addressing, and to use document.getElementById(id) for each access. But, for the adept, it is much better to make use of the DOM tree when addressing elements (but remembering the short cut available in form I/O elements). -- (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05. Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1209@merlyn.demon.co.uk> |
|---|---|
| Date | 2012-03-01 20:52 +0000 |
| Message-ID | <pvoVyQMVG+TPFw4D@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #12216 |
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>.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-25 13:12 +0100 |
| Message-ID | <1938517.aqSPkdTlGX@PointedEars.de> |
| In reply to | #12142 |
Cal Who wrote:
>
> >
>> However, the proper way to refer to the value of the control is
>>
>> document.forms["ScrabbleStopWatch"].elements["timeTotal"].value
>
> Does this work in IE and Firefox?
It works in any scriptable browser as it originates from JavaScript 1.0 in
Netscape Navigator 2.0 (which later was moved from the programming language
to the Gecko DOM API, whereas Firefox is powered by Gecko) and the MSHTML
DOM API in Internet Explorer 3.0, the so-called "DOM Level 0".
> I've seen the getElementById used many times.
Possible, but that has nothing to do with what I commented on. Which one
could see had you quoted properly.
<http://jibbering.com/faq/#posting>
There is also an extra leading space in your From header field value, which
you might want to remove. Can one use your From header field value
*unchanged* to contact you via e-mail? If not, you want to fix that as
well.
> Is this the old way
No, it is part of "the new way", but it is often used in spite of better
approaches, and too often in a program. The referencing I described above
is both "old" ("DOM Level 0") and "new" (DOM Level 2 HTML, HTML5 Working
Draft).
> and what you show is now replacing it.
No.
> If so, why is the new way better?
The use of collections is better than shortcut referencing because the
former is *both* backwards-compatible *and* standardized, and there is less
chance for ambiguity (consider formRef.action etc. -- form control or not?).
Shortcut references are only backwards-compatible and probably compatible
for now. They are neither specified by W3C DOM Level 2 HTML nor the most
recent HTML5 Working Draft.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2012-02-25 04:36 +0000 |
| Message-ID | <4f486548$0$4160$a8266bb1@newsreader.readnews.com> |
| In reply to | #12136 |
On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: >> numv = floatVal(document.ScrabbleStopWatch.timeTotal.value); > Is floatVal exactly the same as parseFloat? I notice you used parseFloat > below. No, floatVal was a typo for parseFloat ;) Rgds Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | " Cal Who" <CalWhoNOSPAM@roadrunner.com> |
|---|---|
| Date | 2012-02-25 09:13 -0500 |
| Message-ID | <jiaq9t$nvc$1@dont-email.me> |
| In reply to | #12145 |
"Denis McMahon" <denismfmcmahon@gmail.com> wrote in message news:4f486548$0$4160$a8266bb1@newsreader.readnews.com... > On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: > > >>> numv = floatVal(document.ScrabbleStopWatch.timeTotal.value); > >> Is floatVal exactly the same as parseFloat? I notice you used parseFloat >> below. > > No, floatVal was a typo for parseFloat ;) > > Rgds > > Denis McMahon Thanks
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2012-02-25 04:41 +0000 |
| Message-ID | <4f486668$0$4158$a8266bb1@newsreader.readnews.com> |
| In reply to | #12136 |
On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: > Do you neam - not use a <form> at all unless there is an element that > causes a form submit like --- for example, what? Yes, you only need to group input elements in a form if you're actually submitting them with a submit button or method. If you're using the elements to provide a user interface to some javascript code on the same page, for example to provide a calculator of some sort, then you don't need to group them with a form, and you are just as well off using ids to refer to individual elements. As to the relative merits of the different methods, you'll probably find more opinions here than there are regular posters. :) Rgds Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-25 13:13 +0100 |
| Message-ID | <2263485.FRqVoOGUtd@PointedEars.de> |
| In reply to | #12146 |
Denis McMahon wrote: > On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: >> Do you neam - not use a <form> at all unless there is an element that >> causes a form submit like --- for example, what? > > Yes, you only need to group input elements in a form if you're actually > submitting them with a submit button or method. Wrong, as already explained. PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee
[toc] | [prev] | [next] | [standalone]
| From | " Cal Who" <CalWhoNOSPAM@roadrunner.com> |
|---|---|
| Date | 2012-02-25 09:17 -0500 |
| Message-ID | <jiaqh7$p75$1@dont-email.me> |
| In reply to | #12162 |
"Thomas 'PointedEars' Lahn" <PointedEars@web.de> wrote in message news:2263485.FRqVoOGUtd@PointedEars.de... > Denis McMahon wrote: > >> On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: >>> Do you neam - not use a <form> at all unless there is an element that >>> causes a form submit like --- for example, what? >> >> Yes, you only need to group input elements in a form if you're actually >> submitting them with a submit button or method. > > Wrong, as already explained. > Thanks Is this how you like replies? Is this not top posting?
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2012-02-27 17:52 +0100 |
| Subject | [OT] Quoting style (was: Cant use <input text as a numeric) |
| Message-ID | <2288631.FRqVoOGUtd@PointedEars.de> |
| In reply to | #12174 |
Cal Who wrote:
^
> "Thomas 'PointedEars' Lahn" <PointedEars@web.de> wrote in message
> news:2263485.FRqVoOGUtd@PointedEars.de...
^^^^^^^^^^^^^^
>> Denis McMahon wrote:
>>> On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote:
>>>> Do you neam - not use a <form> at all unless there is an element that
>>>> causes a form submit like --- for example, what?
>>>
>>> Yes, you only need to group input elements in a form if you're actually
>>> submitting them with a submit button or method.
>>
>> Wrong, as already explained.
>
> Thanks
You are welcome.
> Is this how you like replies?
It is how the accepted quoting style in Usenet in general and this newsgroup
in particular (see the FAQ) looks like, which happens to agree with me as
well (except for the attribution novel, which I think should be replaced
with a short, easier readable attribution line; some Usenet tutorials agree
[1]). An extra *empty* line between quotes and new text is recommended.
There is still an extra leading space character in your From header field.
> Is this not top posting?
Yes.
Such off-topic questions are better asked in newsgroups for new users, or
via e-mail.
PointedEars, F'up2 poster (meaning: please only reply to this via e-mail;
CAUTION: Your newsreader gets this *wrong* too, so get a working one first.)
___________
[1] <http://learn.to/quote>
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
| From | " Cal Who" <CalWhoNOSPAM@roadrunner.com> |
|---|---|
| Date | 2012-02-25 09:15 -0500 |
| Message-ID | <jiaqdq$onq$1@dont-email.me> |
| In reply to | #12146 |
"Denis McMahon" <denismfmcmahon@gmail.com> wrote in message news:4f486668$0$4158$a8266bb1@newsreader.readnews.com... > On Fri, 24 Feb 2012 17:48:56 -0500, Cal Who wrote: > >> Do you neam - not use a <form> at all unless there is an element that >> causes a form submit like --- for example, what? > > If you're using the elements to provide a user interface to some > javascript code on the same page, for example to provide a calculator of > some sort, then you don't need to group them with a form, and you are > just as well off using ids to refer to individual elements. > > As to the relative merits of the different methods, you'll probably find > more opinions here than there are regular posters. :) > > Rgds > > Denis McMahon Thanks
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1208@merlyn.demon.co.uk> |
|---|---|
| Date | 2012-02-25 21:00 +0000 |
| Message-ID | <TyFLlfRmvUSPFw3Q@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #12135 |
In comp.lang.javascript message <4f481090$0$4322$a8266bb1@newsreader.rea
dnews.com>, Fri, 24 Feb 2012 22:34:56, Denis McMahon
<denismfmcmahon@gmail.com> posted:
>But the more common way these days
With the US-led dumbing-down of society, "common way these days" is an
unreliable commendation.
>is to not use a form if you're not
>actually submitting the form data in a request, rather assign each field
>an id value and:
Using IDs more liberally than is necessary goes against the whole idea
of structured programming. One should use the DOM tree. But, with a
form, it is easy to address, by name, controls on the form.
>document.getElementById("element_id").value = "a string value";
>
>var strval = document.getElementById("element_id").value;
>
>var intval = parseInt(document.getElementById("element_id").value);
Method parseInt should always have a second argument, usually 10, unless
circumstances prove it unnecessary. Using unary + is safer unless some
special property of parseInt is needed.
>var floatval = parseFloat(document.getElementById("element_id").value);
Unary + generally serves.
--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.javascript
csiph-web