[thelist] AJAX Tip

Christian Heilmann codepo8 at gmail.com
Thu Apr 6 07:28:56 CDT 2006


> > > How do you NOT use the DOM when you want to do unobtrusive Scripting?
> > > Even if it is DOM-1?

> > Hmm, let's see...
> >
> > <a href="picture.jpg" onclick="return showPicture(this, 'picture.jpg');"><img
> > src="thumbnail.jpg" /></a>
>
> That is the part that is not unobtrusive. There should not be JS in
> the markup. I think this is where Christian is confused, because
> typically you'd do:
> var foo = document.getElementById('...');
> if (foo) foo.onclick = function() { showPicture('picture.jpg'); };

Exactly. Unobtrusive JavaScript should be unobtrusive to both the user
and the maintainer. Mixing HTML and JavaScript is just lazy and
expects a lot more from a site maintainer than is necessary.


Chris

--
Chris Heilmann
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/
Binaries: http://www.onlinetools.org/



More information about the thelist mailing list