Hi,

Since that's not actually a link (the href points to the javascript: URL scheme which is an ugly hack), what's wrong with:

<span id="print" class="link"></span>

How is an empty span less harmful than an empty a element without an href attribute?

Where the link class may be styled to look like a link with CSS, and then

var elm = document.getElementById("print");
elm.onclick = window.print;
elm.appendChild(document.createTextNode("Print this page"));

For keyboard access, you need a tabindex="0" which has no effect in legacy UAs, and you currently can't trigger the click event from keyboard in IE6 or Firefox on a span element.

The javascript: URI scheme is a separate issue. If we replace the href with "http://example.org/"; -- or "mailto:[EMAIL PROTECTED]", or "data:,foo", or whatever -- in my first example, I would still like to use an empty a element in the markup.

Regards,
Simon Pieters


Reply via email to