[Javascript] How to dim buttons

Walter Torres walter at torres.ws
Tue Nov 11 14:22:55 CST 2003


In Perl an PHP a double quoted string will be parsed so that any variables
inside those quotes will be expanded.

i.e:
  x = 'hi';
  y = 'x Bob';
  z = "x Bob";

'y' will produce [x Bob]
'z' will produce [hi Bob]

Javascript does not have this "feature"

Single or double quoted strings are just strings.

But!

Code validation is another story. In order for a document to validate, it
has to have double quoted attribute values. Now, I'm not sure if this is
true with HTML 3/4, bit I do know it is true with xHTML 1.0/1.1.

Using single quotes has been a long habit of mine, a hold over from my Perl
development days. But, since I want my page to validate (for the most part,
but that is a different story) I now use double quotes on all my TAG
attribute values.

So, anyway, in JavaScript, there is really, from a language POV, much of a
difference. It all depends on your view of document validation.

Walter



> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu]On Behalf Of Mike Dougherty
> Sent: Tuesday, November 11, 2003 11:45 AM
> To: [JavaScript List]
> Subject: RE: [Javascript] How to dim buttons
>
>
> Why would it matter which quote style is used?
>
> -----Original Message-----
> From: javascript-bounces at LaTech.edu
> [mailto:javascript-bounces at LaTech.edu] On Behalf Of Håkan Magnusson
> Sent: Tuesday, November 11, 2003 12:13 PM
> To: [JavaScript List]
> Subject: Re: [Javascript] How to dim buttons
>
>
> I rather use double quotes when I want to automatically escape my
> string, and single quotes when I don't need any escaping, since the
> single quotes parse about a billion times faster than double quotes.
>
> David Lovering wrote:
>
> > As far as I know, any dynamic object (something which accepts a
> > change-of-state) can be disabled in this fashion, at least according
> to my
> > interpretation of the W3C standard.  I would generally suggest using a
> > white-space delimeter on both sides of the equal sign, and for
> anything
> > which is not a numeric contstant using double-quotes around the
> left-side
> > quantity.  For example:
> >
> >   document.forms[0].mybutton.disabled = "true";
> >
> > This will work better on a larger number of browsers of varying
> vintages.
> >
> > IE in its later versions allows even "static" objects (like labels,
> TR, TD,
> > etc.) to be disabled in this fashion, but the results are often rather
> > surprising.  Instead, I would recommend changing the CSS attribute
> > ".visible" to "hidden" for a static object, as it is more intuitive
> and
> > portable.
> >
> > -- Dave Lovering
> >
> > ----- Original Message -----
> > From: "Robert Pollard" <rpollard at apple.com>
> > To: <Javascript at LaTech.edu>
> > Sent: Tuesday, November 11, 2003 9:37 AM
> > Subject: [Javascript] How to dim buttons
> >
> >
> >
> >>Hello all,
> >>
> >>I saw a page that had JavaScript that dimmed a button with the syntax
> >>document.button.disabled=true.  Is this something that is available to
> >>all browsers or is it limited to specific ones?
> >>
> >>I've never seen this in any documentation.  Can this be done to other
> >>objects as well?
> >>
> >>Thanks,
> >>
> >>Robert Pollard
> >>
> >>_______________________________________________
> >>Javascript mailing list
> >>Javascript at LaTech.edu
> >>https://lists.LaTech.edu/mailman/listinfo/javascript
> >>
> >>
> >
> >
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> > .
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list