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

Onsubmit analogue needed for A elements

From: David Woolley <david.woolley@bts.co.uk>
Date: Sat, 13 Jan 2001 12:12:26 +0000 (GMT)
Message-Id: <200101131212.f0DCCQn03362@djwhome.demon.co.uk>
To: www-html@w3.org
Forms have an onsubmit event that can be used to intercept the
submission of a form (e.g. for validation), but there is no
analogue for A elements.  Current web idioms and pending legislation
make such an analogue desirable.

Although it might not be obvious that you would want to intercept
normal links, there are good reasons for doing so.  The most obvious
current one is that there is a current epidemic of sites using
something like <a href="javascript: popup (key_to_forming_URL)".  These
are dead links for search engines and for browsing without scripting.

I think the currently best advice for such links (rarely followed,
and leaving aside the undesirablity of popups) is to make the href be a
"real" URL and use onclick (with a false return) to trigger the popups.
The problem with this is that onclick is a mouse event, not a generic
event, whereas onsubmit is generic.  In real life, a non GUI browser
would have to interpret onclick as meaning its link activation action
and make assumptions about mouse buttons and shift key states, but this
is not really a satisfactory approach.

Better, I think would be an onactivate event, or to overload onsubmit
to include the activation of A type links.

Note also that the W3C Accessibility guidelines, as well the US Section
508 rules, call for the use of device independent events.

Like many things, the horse has probably already bolted, so one would
end up with onclick and onactivate being the same (or one calling the
other), rather than just onactivate, and it will be difficult to convince
people, who don't even realise that there is a problem with non-script
users, to do this.
--------------------------- DISCLAIMER ---------------------------------
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of BTS.
Received on Saturday, 13 January 2001 07:37:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:05:55 UTC