[111Design.ca]

111Design Consulting

Supporting Industry Standards and Accessibility [Navigation]

Menu

[toxic waste]

design tips

You are here:  Design Tips » Javascript

tip#2

The Use of Javascript

Javascript is a client-side programming language used to generate dynamic content or special effects... nothing critical to the Site's functionality in a perfect world. Using javascript for navigation is a very bad idea. Unless you provide non-java browsers (and visitors who *choose* to surf with javascript turned off) some alternate means of getting from page to page, they are going to be stranded. Search engines can't index sub pages either because they only recognize valid links. Drop-down menus that use the form tag and javascript should have a button the user can click to activate his selection. A set of plain text links to your important pages need_not_be_visible. It can be hidden from java-enabled browsers in the noscript tag. (This needs to be formatted like any other HTML element.)

Don't create pop-up windows. Anyone who has used a java-enabled browser for more than a week will have learned that you NEVER click on things that pop up unexpectedly. Most up-to-date browsers can block them anyway. Turning javascript off will block them too (so you don't need special anti-pop software). If you have a "free" Site with one or more pop-ups exploding on every page entry and exit, for Pete's sake, upgrade to a paid account. It could cost you as little as $6.00 per month and eliminate these ads. Your visitors will thank you. Hey, they might even come back. I generally avoid linking to Sites that have pop-ups, and I'm sure a lot of folks feel the same.

In XHTML, inline javascript comment tags look like this:
 
//<![CDATA[
script code goes in here
//]]>

Wherever possible, use Server Side Includes and remove all comments that are not absolutely necessary.

Combining several scripts into one by calling each as a function can sometimes resolve conflicts that result in javascript errors. It will also take up less space.


Copyright © 2003-2009, 111Design.ca