Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: incrediBILL

Message Too Old, No Replies

Multiple Access Keys

     
2:56 pm on Feb 28, 2008 (gmt 0)

5+ Year Member



Hello,

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>

or

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

or

<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.

4:09 pm on Feb 28, 2008 (gmt 0)

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



According to the HTML spec:
[w3.org...]

The accesskey attribute takes single character data:
[w3.org...]

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.

4:10 pm on Feb 28, 2008 (gmt 0)

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



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?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month