Designing with JavaScript

If you’re building your site with JavaScript, don’t just throw it all in there. If someone with JS disabled visits your site, they’ll be greeted by a bunch of things that don’t work.
“But only a few people have scripting disabled!” you’d shout.
Remember this: JavaScript has the ability to remodel the page completely. You can change anything.

How to go about some Business

Build the page as if you didn’t have JavaScript. Remove the cleverly-scripted slideshows, the dead links that use AJAX calls, and any other little piece of the site that relies on scripting to achieve a satisfactory effect.
For forms and links, try using PHP and putting in links to proper pages. Maybe try an image with a hyperlink to your slides. make the site work as well as possible without any scripting at all.

The Magic

Now here’s where the magic comes in. In your script, use DOM scripting to add those AJAX calls, strip off anything superfluous, cancel default PHP-based events, and create those dynamic controls. You can change styles, add new elements, and alter the data.
Now, when someone visits the site and the script isn’t working, they’ll have the ability to use the site. The rest will still get the same scripted experience they would otherwise have enjoyed.


Leave a Reply