Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Semantics Of Javascript Links/controls

This is a discussion on Semantics Of Javascript Links/controls, within the Accessibility and Usability section. This forum and the thread "Semantics Of Javascript Links/controls" are both part of the Designing Your Website category.

 
Reply to this topicStart new topic
> Semantics Of Javascript Links/controls, Which elements to use? How to present them?
MikeHopley
post Jun 17 2008, 08:56 AM
Post #1


Squeeze Machine
*****

Group: Mentor
Posts: 507
Joined: 15-February 08
From: UK
Member No.: 143



I'm thinking about the usability of javascript-based controls. I have two main questions:
  1. Which elements should we use for javascript events? <a>? <button>?
  2. How should we present these to make it clear that they are "action items" rather than "navigation items"?
Here are my (rather hazy) thoughts at the moment:

1. Which elements?

Links

The classic element is a standard link. For example:

CODE
<a href="#" id="swapBackground">Change the background colour</a>

This is what I use by default, simply because that's what I've always done. But now I'm beginning to question this markup choice. Why use a link? The standard meaning of the <a> element is this: "I will take you to another page". But javascript links don't do this. How often have you tried to open a javascript link in a tab? I often do; it's annoying.


Buttons
The standard meaning of the <button> element is this: "I will perform some action". Buttons, therefore, seem like a good choice of markup.

Of course, the presenation of a button is independent of the markup. Even if you want your javascript controls to look like links, buttons may be better markup.


Specific controls
Checkboxes and radio buttons are ideal, provided that your action fits their metaphor.

How do people feel about using checkboxes/radios to perform an immediate action, rather than requiring a "submit" or "save preferences" (or whatever) button? Obviously this is bad when the action is disruptive, such as submitting a form; but what about AJAX-style interfaces that give immediate feedback?

(Jakob Nielsen has a good column on checkboxes/radios.)


Pop-up actions (or "false pop-ups")
A typical example is a pop-up help box. By pop-ups, I mean anything that fills this role; personally, I prefer to use "false pop-ups" (in-page CSS/JS <div> effects) rather than annoy users by spawning a new window.

Nevertheless, there's still a usability issue. What kind of element should be used? Links? Buttons?


2. Presentation

Once we've chosen our javascript control element (<a>, <button>, or whatever), how should we style it to help make the behaviour predictable?

Buttons should be fine, as long as they still look like buttons; there's even an argument for applying no special styles, so that you get whatever button style the user is most familiar with. The only trouble with buttons is that they are pretty clunky-looking, especially when deployed en masse.

What about links? I've been distinguishing my javascript links with a different colour (red instead of blue) and a dotted underline (rather than solid). But how effective is this?

For help links, such as links that spawn a pop-up help box, I also like to change the cursor with the CSS { cursor: help }.


Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 temi 275 14th February 2008 - 09:15 AM
Last post by: Simon
No New Posts   0 geti 201 14th February 2008 - 03:50 AM
Last post by: geti
No New Posts   6 unitedcraig 226 21st February 2008 - 09:21 AM
Last post by: thesealportalteam
No New Posts   2 marSoul 170 23rd February 2008 - 10:52 AM
Last post by: marSoul
No New Posts   9 Sharron 265 28th February 2008 - 11:28 AM
Last post by: Sharron