Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: incrediBILL
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.
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.
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?