[Javascript] detect js

Matt Warden mwarden at gmail.com
Sat Jan 29 01:07:47 CST 2005


On Fri, 28 Jan 2005 16:15:28 -0800, Paul Novitski
<paul at novitskisoftware.com> wrote:
> Matt,
> 
> I agree with you completely about isolating javascript and CSS in external
> files.
> 
> But did I miss something?  I didn't recall Ron suggesting using inline
> javascript, only the use of document.write.  I haven't used document.write
> in a while, but I don't recall any restriction on using it from an external
> file.  In case I've forgotten something important, please elucidate.

I wasn't really talking about inline JS. I mentioned inline styles,
which might have put that into your head. (However, I'm not sure how
you're going to end up calling the function in the external JS file
without using inline javascript where you want the markup written.)

Anyway, what I mean is: I don't really see anything better with this:

<script type="text/javascript">
function writeStuff()
{
        document.write('<input type="text" ... />');
} // end function
</script>

<div><script type="text/javascript">writeStuff();</script></div>

than with this:

<p><script type="text/javascript">document.write(codename);</script></p>

I guess maybe we are getting into a useless argument over detail.
However, personally, I far prefer a technique that uses DOM to add
nodes to a technique that uses document.write to print markup.


-- 
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