[Javascript] How to dim buttons

Håkan Magnusson hakan at backbase.com
Wed Nov 12 03:05:11 CST 2003


Nope, actually a double quoted string are given the escaping treatment, 
while the single quoted strings are not. That's why it's faster. :-)

David T. Lovering wrote:
> I too hadn't heard about the difference in parsing time -- I thought the selection of single or double-quotes was more a matter of convention (and whether you'd started the string with the other).
> 
> -- Dave Lovering
> 
> Mike Dougherty wrote:
> 
>>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
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> .
> 




More information about the Javascript mailing list