A few links I’ve found interesting or useful over the last week:
Inserting at the cursor using JavaScript
This is a highly effective trick for enhancing the usability of forms, the topic of my recent SitePoint article. It’s particularly useful for text entry fields for content management systems – for example, providing users with an “add image” widget that prompts them for a URL and ALT attribute and then inserts the corresponding HTML at their current cursor position. Alex King’s code sample works in both IE and Mozilla, which each provide different ways for accessing the current cursor position.
You’ve probably heard of image replacement (if not this excellent summary by Dave Shea should get you up to speed). IFR is an interesting twist on the idea from Shaun Inman, which uses Javascript and Flash to extract the text from headers on a page and replace each header with a Flash rendered equivalent. This enables advanced text styling effects and also lets you use fonts for your headers which aren’t available on the host operating system.
ALA and JavaScript – five months later
PPK is the maintainer of QuirksMode.org, and a vocal commentator on Javascript and related technologies. In this article he reviews six articles from A List Apart concerning Javascript, rating the quality of the articles and the usefulness of the techniques they espouse. I was going to link to the ALA articles individually, but PPK’s evaluations add extra value to the originals.
Separating behavior and structure
Another piece from PPK, this time a column espousing the virtues of smart Javascript and unobtrusive scripting. He plugs my Enhancing Structural Markup with JavaScript article, which is reassuring to say the least! PPK’s core message is stop writing JavaScript instructions in XHTML files – which pretty much condenses my thoughts on Javascript best practises down to a single sentence.
XHTML 1.0 Strict Not Ready For Prime Time?
D. Keith Robinson hosts some excellent discussions on his weblog, and this is one of them. I actually disagree with Keith’s intial post: if I’m going to use XHTML, I use XHTML 1.0 Strict without a second thought because I have no use for any of the features in XHTML Transitional, and so far I’ve emanaged to avoid any strange problems in doing so. I actually prefer HTML 4.01 Strict for general projects, but that’s probably a topic for another post. At any rate, the ensuing discussion on Keith’s blog is well worth perusing.