June 8, 2007
Wanted Dead: Bad Tags
Bad tags usually come down to tags that are presentational, which is the realm of CSS, or simply not valid, leading to unreliable code that can’t be guaranteed to work on different or future browsers.
Bad tags usually come down to tags that are presentational, which is the realm of CSS, or simply not valid, leading to unreliable code that can’t be guaranteed to work on different or future browsers.
After finishing the main topics from our book for this season, I'd thought I'd update an example we covered last season using some of the DOM techniques we have learned so far. Back in the January 06 meeting I showed you how to create image rollovers using the Image object and the onMouseOut and onMouseOver event handlers. The code worked fine, but had a small problem.
Should you use popup windows? Popup windows have gained a bad reputation from marketers' aggressive use of them, but even requested popups can be barriers to good usability. There are situations where popping a new window is arguably the most appropriate solution. Popups are mostly used for one-page interfaces or those in which history navigation is discouraged, such as a survey or a logon page for a commercial web site.
My use for external windows (not popups) use scripting that degrades if not available. We have already discussed this issue at our unobtrusive discussion.
With HTML pages on the web you can just include the required Javascript between tags. When you validate the HTML on your web page the Javascript content is considered to be CDATA (character data) that is therefore ignored by the validator. The same is not true if you follow the more recent XHTML standards in setting up your web page. With XHTML the code between the script tags is considered to be PCDATA (parsed character data) which is therefore processed by the validator.
Because of this, you can't just include Javascript between the script tags on your page without 'breaking' your web page (at least as far as the validator is concerned).
Web development happens on several layers:
Unobtrusive JavaScript is the separation of these layers which allows web designers to create web sites that are a lot easier to use and maintain, more intuitive, and accessible.