W3C home > Mailing lists > Public > www-html@w3.org > July 2001

Re: suggestion: althref for <a> in the spirit of 'alt for <img>'

From: Tim Bagot <tsb-w3-html-0003@earth.li>
Date: Thu, 26 Jul 2001 11:00:08 +0000 (UTC)
To: <www-html@w3.org>
cc: Jungshik Shin <jshin@pantheon.yale.edu>
Message-ID: <Pine.LNX.4.33.0107261033360.1249-100000@windle.hack>
At 2001-07-25T14:32-0400, Jungshik Shin wrote:-

> I've been thinking about how to make pages with lots of hrefs to
> 'javascript:......' accesible via browsers not supporting Java script
> (such as Lynx). At first <noscript> appeared to solve the problem. I
> tried the following with Lynx 2.8.x

You are at least trying to make your documents accessible, which is an
admirable aim, and more than many do.

> <script language="javascript">

(The language attribute is obsolete - the correct form would now be
type="text/javascript" (except that no such MIME type has been
registered yet).)

> <a href='javascript:_win("link1.html")'>
> <img src="button.gif" alt="button"></a>
> <noscript><a href="link1.html"><img src="button.gif" alt="button"></a>
> </noscript>
> A problem with this is that Lynx displays *both* links and it's natural
> that it should do because there's no way for Lynx to figure out
> the first link should be ignored.

A common method used to get around this sort of problem in a more general
way is to generate the scripting-only content with document.write() or
similar. I can't recommend this, as it is really rather unpleasant.

> I thought that it'd be nice if there's a kind of alt-attribute
> equivalent for <a>. That is, something like the following would
> be nice:
> <a href="javascript:_win('link1.html',abc, def)" althref="link1.html">
> Link1</a>

This is not necessary, as there is already a similar mechanism: use the
href attribute to link to the resource, and call the script function from
an event attribute such as onclick. This is already guaranteed to work on
existing software with no knowledge of scripting.

(Incidentally, there is no javascript URI scheme, and unconditionally
opening new windows is considered unfriendly, since it may be confusing to
someone who cannot see that it has happened, and frequently annoys other
users. I strongly ecommend that you read the Web Content Accessibility
Guidelines at <http://www.w3.org/TR/WCAG10/>.)

Tim Bagot
Received on Thursday, 26 July 2001 07:00:11 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 30 April 2020 16:20:43 UTC