Bob Schwartz wrote:
Lachlan,
By far, the most important issue facing beginners with regards to
standards is the separation of semantics, presentation and behavioural
layers into well structured, valid, non-presentational markup; CSS and
javascript, respectively, and it sounds like you've already made
significant steps toward these goals already.
Just to be clear I've understood a concept you mention above, could you
show an example of javascript used as layered, non-presentational markup
and one that is not?
When you mix behavioural attributes within the markup, like onclick,
onmouseover, etc. or javascript: pseudo-URI schemes, that's the
behavioural equivalent of including presentational attributes within
your markup. Instead of using those attributes, the best practice is to
attach event listeners dynamically instead.
For example:
Bad:
<a href="javascript:myPopup('foo.html');">evil popup</a>
Better:
<a href="foo.html" onclick="myPopup(this.href);return
false;">not-so-evil popup</a>
Good:
<a href="foo.html" id="foo">Not an evil popup</a>
<script src="popup.js" type="text/javasript>
document.getElementById("foo").addEventListener("click", myPopup, false);
or
document.getElementById("foo").onclick = myPopup;
Note: IMHO, all popups are evil and intrusive and must not be used under
any circumstances, but this is an illustration of how to make them a
little more accessible by separating the behaviour layer from the markup
layer.
For a better explanation and other techniques, see:
http://www.onlinetools.org/articles/unobtrusivejavascript/
--
Lachlan Hunt
http://lachy.id.au/
******************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************