parseInt() and CSS naming was Re: [thelist] javascript "won't" subtract

Emma Jane Hogbin emmajane at
Sun Mar 9 14:28:01 CST 2003

On Sat, Mar 08, 2003 at 04:45:46PM -0600, Erik Mattheis wrote:
> JavaScript isn't a typed language, so it will treat a number as a
> number when needed and as a string when needed - so no need to use
> parseInt() (that's not the problem but it's unneeded.

I've found in some forms that this /is/ actually needed. It's been ages
since I first ran across the problem and I don't remember which browsers
it was in but... when the data came in from the form javascript was
treating it as as string containing a "number" instead of an actual number.
As a result I've gotten into the habit of wrapping form numbers in parseInt().

> Also, I believe the same naming convention of not starting with a digit
> applies to the id and name attributes in HTML

I remember that convention as well -- however, the page validates as XHTML
1.0 transitional AND CSS-2 happy. I went back and looked through the specs
and couldn't find anything on naming conventions. Does anyone know where
the W3C hides that info? I breezed through ID in both CSS-1 and CSS-2, but
I didn't see it. There's also the rule of no dashes in IDs and CLASSes, but again
I couldn't find it in the actual spec.


Emma Jane Hogbin
[[ 416 417 2868 ][ ]]

More information about the thelist mailing list