[thelist] Top 10 JavaScripts

Jeff Howden jeff at jeffhowden.com
Sat Oct 18 03:21:09 CDT 2003


diane,

i figure you've probably already kill-filtered email from me to your trash,
but hopefully others on thelist that share your opinions about this thread
will gain something from this post.  so, with or without you, here goes:

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Diane Soini
>
> If they aren't able to learn it, what is wrong, then,
> with the ones that come in Dreamweaver? They are bloated
> for sure, but they've thought out pretty well how to get
> them to work in most browsers most of the time. [...]
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

the problem isn't with the scripts dreamweaver provides (though i take issue
with how overly complex some of them are), but the fact that
"developers/designers" that don't know what they're doing are using them.
they don't when enough is enough, they don't know how to put things together
to be as accessible as possible, and they too often will use scripting for
scripting sake, not because it actually serves a useful purpose.

some great examples are the use of dhtml menus when some good ia would have
been a more effective solution, image rollovers when some creative use of
css would have done the job much better (smaller, faster, and doesn't
require scripting), etc.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> [...] Plus they seem to have included the ones that
> would probably qualify as in the top 10. [...]
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i would hardly consider the typical eye-candy scripting to be in the top 10,
unless we're talking about the top 10 stupid scripting tricks.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> So, perhaps you could pick some of the Dreamweaver
> scripts and teach them how to use them. Or maybe you
> could go through the Dreamweaver scripts and then find
> similar scripts online and do a lesson in comparison.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

no way.  the dreamweaver scripts are *far* too complex for even your above
average scripter to figure out.

more importantly, if you're not going to make time to talk about the
pitfalls of scripting, then don't take the time to talk about all the cool
things you can do with it.  otherwise you end up unleashing clueless little
demons to make the web an even worse place than it already is.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> First of all, I've never met a script I can just plug
> and play without doing some kind of edit to it. [...]
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i can think of at least one:
http://evolt.jeffhowden.com/jeff/code/preload_n_rollover/index.cfm

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 1. Scripts that open popup windows. Need to know all the
>    browser chrome and other settings you can configure
>    in the third argument of window.open(), plus you need
>    to know that it returns an object, so you need to
>    know to make void if used in the href attribute.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

stop right there.  sounds like you're calling the open() method from a link
and not within a function.  you're opening yourself up for a ton of problem.
additionally, you want to know that window.open() returns an object because
that means you have a handle to do things to that window later, not because
you might be calling it from the href attribute (tsk tsk).

i've got two articles you need to read.

Links & JavaScript Living Together in Harmony
http://evolt.org/article/thelist/17/20938/

JavaScript: The Point of No Return?!
http://evolt.org/article/thelist/17/8869/

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 2. Scripts that change the parent window after a popup
>    window has opened. That would be window.opener
>    scripts.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

useful, but certainly not in the top 10.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 3. Scripts that toggle visibility of divs or layers or
>    whatever. Along with the accompanying various ways
>    to get a handle on the object you are trying to
>    show/hide.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

toggling visibility (i think you actually mean display) should be reserved
for developers that know when not to use this technique.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 4. Scripts for validating forms. This can get a bit
>    complicated.  Dreamweaver can handle that pretty
>    well, so maybe it's best for your needs to stick
>    with that. To be honest, form validation with
>    javascript is beyond me.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

i wouldn't bother even talking about form validation.  if these students are
just beginners then they're not going to have the knowledge necessary to
implement server-side checking.  without that the javascript form validation
is completely pointless.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 5. Scripts for doing mouseover image effects.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

image rollovers are so 2001.

there's rarely an image rollover that isn't better off being done with css.

http://rheegold.com/

Those tabs top and bottom are done with css (yes, i know they're off
slightly in moz, but the 0.025% of the users that use moz don't justify the
time to figure out why).

http://gemsnjewelry.com/

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 6. Not technically a script, but I think it's important
>    to know how to debug a script using alert();
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

agreed.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 7. Document write scripts. It's good to know how to do
>    that.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

also very 2001.

documents should not contain scripting in the body these days.  there's no
point.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 8. Scripts that do stuff to other frames. If you are
>    teaching frames.  (Please no arguments about frames
>    -- if you are learning HTML it's good to know frames.
>    Better to know everything and not use it than know
>    very little and not be able to use it if needed.)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

there's a logical fallacy there.  you can't teach everything and do more
than just skim the material, leaving the student with very little knowledge
about any specific thing.  better to focus on the things they'll actually
use 90% of the time and give them the research tools to learn about the
things you didn't cover should the need to use them arise.

a tool in untrained hands is a dangerous tool indeed.

.jeff

------------------------------------------------------
Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/



More information about the thelist mailing list