Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <2760364.jIkiNM8doB@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 18 Aug 2012 19:18:19 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 80 NNTP-Posting-Date: 18 Aug 2012 19:18:19 CEST NNTP-Posting-Host: 8c9c8561.newsspool4.arcor-online.net X-Trace: DXC=he6D6F9RdIj:i=48;n?Z:`4IUK In my Spherical Triangle Calculator: > > https://files.nyu.edu/emf202/public/js/spherical.html > > one can select 1 of 3 radio buttons. Degrees and Radians affect the > input and the output, while degmin affects the output only. > > I considered making the deg°min' a checkbox instead: > > https://files.nyu.edu/emf202/public/js/spherical2.html > > but there are problems with the code. To begin with, if you click > Radians, the degmin checkbox *is* disabled, but then when I click Clear > while the Degrees is selected the degmin remains disabled. You could call the "Degrees" radiobutton's onclick() property when the "Clear" button is activated, or you could simply call the function called the former's click event listener. The latter is probably more compatible, but in more than a decade of browser scripting I have not yet encountered a DOM where calling the onclick() property would fail under these circumstances.¹ You may even call the radiobutton's click() method instead if it has any, or despatch a `click' event to it, but tests as to that are pending as well. ¹ Indeed, the HTML5 Working Draft suggests that calling the onclick() property is well-supported even with a HTML 4.01 DOM API: > Also, I'd prefer if the radio buttons and the checkbox are outside the > dataForm, so their settings won't change with Clear, but then when > clicking Calculate, it should be able to tell the current status of the > buttons/checkbox. A reset button in a form is usually a bad idea to begin with as it carries with it the risk of accidentally undoing all user inputs², but in your case an exception can be made. Therefore, it is a bad idea to place form controls outside the form because then it could not be made to work without client-side DOM scripting, which you should consider implementing. ² > […] > > > > ... Your LABEL elements do not work (clicking them does not focus the control) in Chromium 21.0.1180.75 Built on Debian wheezy/sid, running on Debian 6.0.5 (150248), and most certainly other browsers, because you have not specified the `rads' aso. IDs on the corresponding form controls. With this approach, you need to omit the `for' attribute on the LABEL elements. However, indication of control activation might be rendered better (such as a dotted line around the text of the label of the activated control, excluding leading and trailing whitespace, as users would expect from other GUIs) if you used the `for' attribute and specified a corresponding `id' attribute on the corresponding control, but would not have the control as a child element of the LABEL element. PointedEars -- When all you know is jQuery, every problem looks $(olvable).