[Javascript] detect js

Matt Warden mwarden at gmail.com
Fri Jan 28 13:20:11 CST 2005


On Fri, 28 Jan 2005 02:15:36 -0500, Ron Koster <ron at psymon.com> wrote:
> Um, why not just use document.write to write out the HTML code for the form
> to log in? If they don't have javascript enabled, they won't see any code,
> of course -- and, naturally, only people with javascript enabled will be
> logging in (which is what was wanted).
> 
> Seems so obvious... is there something I'm missing?

Yes.

See rule #1:
http://www.onlinetools.org/articles/unobtrusivejavascript/chapter1.html

In my opinion, Javascript interspersed with markup is even worse than
inline CSS.

Here is an example of hiding/displaying elements while separating JS,
CSS, and XHTML (JS is in the document only for simplicity -- it could
just as easily be moved to an external file -- same with the CSS):
http://mwarden.f2o.org/sandbox/collapsible_elements.htm



-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the Javascript mailing list