homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Multiple Access Keys

5+ Year Member

Msg#: 3587094 posted 2:56 pm on Feb 28, 2008 (gmt 0)


I'm trying to develop my website for mobile view such as cell phones.

Right now my page displays nine links to different article, each with an accesskey attribute using keys 1-9, to enable people to select a link with thier phone's buttons.

<a href="/foo/" accesskey="4">Foo</a>

I am trying to add a feature to allow people to press 0 to read a random article.

I'm using PHP on my backend to accomplish this, my only problem is trying to have one link with multiple accesskeys and remain valid.

Would it be like:

<a href="/foo/" accesskey="0" accesskey="4">Foo</a>


<a href="/foo/" accesskey="0 4">Foo</a>


<a href="/foo/" accesskey="0,4">Foo</a>

What I want to avoid is cluttering up my page by using:

<a href="/foo/" accesskey="0">Foo</a><a href="/foo/" accesskey="4">Foo</a>

Even though I might be able to use CSS to hide the second link (if CSS is even supported), I don't want to add to the file size.

Any help would be much apprciated.



WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Msg#: 3587094 posted 4:09 pm on Feb 28, 2008 (gmt 0)

According to the HTML spec:

The accesskey attribute takes single character data:

This would imply that you can't assign multiple characters for a single accesskey.

However, could you perhaps do something like this:
<a href="/a1/" accesskey="1">Article 1</a>
<a href="/a2/" accesskey="2">Article 2</a>
<a href="/a3/" accesskey="3">Article 3</a>
<a href="/a8/" accesskey="8">Article 8</a>
<a href="/a9/" accesskey="9">Article 9</a>
<a href="/a2/" accesskey="0">Random</a>

In other words, you show a link for Random, and use PHP to assign the href to one of the existing links. This way, the Random functionality is obvious to your users, and you don't need to replicate the link text.


WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Msg#: 3587094 posted 4:10 pm on Feb 28, 2008 (gmt 0)

As far as I'm aware you can't have more than 1 accesskey specified for any 1 element?! I'm not sure why you would need to?

Just trying to understand... Key 0 reads your random article, whatever that might be (possibly 'Foo'). And key 4 reads your 'Foo' article, the link for which still exists on your page. So both 0 and 4 will read the 'Foo' article, if 'Foo' is your random article. Is that right?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved