WebAIM - Web Accessibility In Mind

E-mail List Archives

RE: best way to use <a href> and javascript?


From: Ian.Lloyd@nationwide.co.uk
Date: Oct 30, 2002 3:47AM


The contents of this email are intended exclusively for the
addressee. If you are not the addressee you must not read
use or disclose the email contents ; you should notify us
immediately [ by clicking "Reply" ] and delete this email.

Nationwide monitors e-mails to ensure its systems operate
effectively and to minimise the risk of viruses. Whilst it has
taken reasonable steps to scan this email, it does not
accept liability for any virus that may be contained in it.

I have written some guidelines on this very topic, which I have pasted in a
raw format at the very bottom of this note. NB - the pop-up function is not
included, but you get the idea.

Hope this helps

Ian Lloyd, Electronic Channels
Nationwide Building Society

tel: 01793-655260
fax: 01793-656368

- -----Original Message-----
[mailto: <EMAIL REMOVED> ]
Sent: 29 October 2002 12:13
Subject: best way to use <a href> and javascript?

Hi all, I was looking for view opinions on this one.
Ive seen before in lots of lists not to use <a href="javascript:function
();">read notes</a> for the reason that screenreaders will read out the
javascript function when they execute the link.
An example often given to fix this is <a href="page.html" onClick
="window.open('page.html');">read notes</a>.
What if you are not linking to a new page though. What if your script is
for rewriting the content of a div.
What can you put in the href if you want to use the onClick method?
Ive used <a href="#" onClick="function();">read notes</a>
Jaws reads this as "link same page read notes" which I know is not good
How are people getting around this one, Id appreciate any thoughts,
Thanks Kieran

The contents of this email and any attachments are confidential.
It is intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the sender immediately and do not disclose the contents to any one or make

** eSafe scanned this email for viruses, vandals and malicious content **

- ----
To subscribe, unsubscribe, or view list archives, visit

- --------------------------------------------------------

The pop-up window may be convenient for presenting information in a slightly
different way from a standard web page. It also presents increased
accessibility problems because:

* it relies on the person browsing to have JavaScript enabled
* it forces a change of window which may be jarring for someone who perhaps
cannot see the window and relies on being told that the window is a new one

However, despite this, there are techniques to make pop-up windows more

Accessibility tips

To ensure your pop-ups are accessible, do the following:

* Pre-warn if a window is launched in a pop-up - this could be either in
body text or in a title attribute of the launcher link, e.g <a href="..."
onClick="..." title="Launch the mortgage quote in a pop-up window">
* Be mindful of what options are available in the pop-up, for example, are
you removing the menu bar and toolbar, thus making it more difficult to
print? Just something to consider.
* Do not rely on the browser to be script-enabled. This means taking a
two-track approach in which you:
* use a simple href
* call the JavaScript function in an onClick event
* use 'return false' to cancel the default action of the href
* use a target window - this is also cancelled out by the return false
href="testpage.htm" - for accessibility
target="popUpWin" - for accessibility
onclick="popUpWin('testpage.htm','standard',300,300); - for script enabled
return false; - for script enabled (cancels out first two accessibility
">Open Pop-up</a>

Version: PGPsdk version 1.1.1 (C) 1997 Pretty Good Privacy, Inc.


To subscribe, unsubscribe, or view list archives,
visit http://www.webaim.org/discussion/