[thelist] (x)html 1.0 validation with javascript

Christopher Mahan chris_mahan at yahoo.com
Thu Jun 24 15:06:26 CDT 2004


--- Michael Pack <michaelpack at wvdhhr.org> wrote:
> IMO it is useful to separate scripts just as one would separate
> styles.
> I store all of my scripts in one folder and call them.
> 
> i.e. <script type="text/javascript" src="scripts/bookmark.js">
> /* ...Javascript called to enable users to add page to bookmarks...
> */
> </script>
> 
> 1. My XHTML is easier to locate, read, and edit
> 2. My scripts are easier to locate, read, and edit
> 3. The validator validates my XHTML and leaves my scripts alone.
> 
> Does anyone find fault with this approach? 

You're right, and it is best to abstract out the logic from
presentation.

Sometimes, however, you need encapsulated documents, where the
document can be saved on the user end and forwarded, reused,
redisplayed, and having no imports is important.

Also, when you want an event to fire during page load, or immediately
after, you need something in the page to call the function
(be it a body onload or inline js).


Also, dependencies are harder to find. If you ahve a js page, you can
wonder which html page is using it, and which functionality would
break should you "upgrade" your js page.

Also, it could be that there are bandwidth issues when getting
multiple or large javascript pages. For example, you've written 40
functions. This page needs 11. You can either have 1 large file and
download all forty to use 11, or have 11 small scripts but then
import 11 pages as script sources.

Also, many people have the "every time I view the page" cache
comparison, and I don't know if imported js files are reimported if
the main page (php for example) changes.

So, it depends on your style. Like you, I generally link, unless I do
a very specific function for that page.



=====
Chris Mahan
818.943.1850 cell
chris_mahan at yahoo.com
chris.mahan at gmail.com
http://www.christophermahan.com/


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail


More information about the thelist mailing list