Archive for the ‘JavaScript’ Category
Accessible News Slider for jQuery v.1.1 - now a plugin and more accessible
After some good feedback from the Web development community, I have revamped the Accessible News Slider. It has been converted into a jQuery plugin, and I am releasing it as version 1.1. The code is not obfuscated, but if you choose to do so, it will come in around 2 KB. The only comments I will make regarding implementation are in the HTML file. These should be sufficient.
The Truncate Plugin for jQuery
Sometime back, after getting comfortable with jQuery, I started researching jQuery plugins. Initially frightened by the seemingly complicated syntax, I brushed them aside. Continuing to hear about the benefits of utilizing plugins, I recently took another crack at it. The result is the Truncate Plugin for jQuery. This plugin is under 1 KB, and is a simple string manipulation tool.
The Accessible jQuery News Slider
One of the complaints of Web 2.0 aficionados is the lack of accessible Web components. Although the argument typically revolves around screen readers, those who wish to conform to WCAG Priority 1 guidelines have much to say as well. Checkpoint 6.3 requires that your site operate when JavaScript is disabled. As much as I disagree with the premise, the reality is that if you must conform, your Web site or Web application will be lacking certain functionality.
Use jQuery expressions and AJAX to browse an XML file
One of the disadvantages to getting an XML file with asynchronous JavaScript has been the limited ability to traverse the nodes, effortlessly displaying a refined result set in HTML. Although Internet Explorer 5+, Firefox 1+, Safari 1.3+ and Opera 9+ do provide basic properties and methods for accomplishing minor tasks, the process for browsing the XML is cumbersome.
Using JavaScript to access an HTML element with multiple class names
Occasionally I discover a nifty solution to a coding obstacle. Although seemingly small, these can be major productivity barriers, especially if you are only a recreational coder. The following is in response to an HTML element that has multiple class names declared.
Pass parameters to your JavaScript functions correctly from setTimeout() using OOP
08/11/08 Update:
This post was revisited with a more intuitive example. Please visit Pass arguments through to your JavaScript functions from setTimeout() (revisited)
If you are moving beyond using JavaScript for simple tasks, and are building full fledged Web applications, then you will likely make heavy use of the setTimeout() method available to the window object. This timer can be powerful, but it also possesses a single shortcoming that stumps even experienced programmers. There is no “built-in” mechanism within setTimeout() for calling a function that needs parameters passed to it.
a href=”javascript:void(0);” — avoid the void
There are plenty of occasions when coding JavaScript events where you simply need to call a function, for which an entire event registration model is too lengthy. The most commonly used method is to bind your event to an anchor link. The user clicks and the onclick event is fired, calling a reference to a function.


