homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Multiple Access Keys
itledi




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

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.

 

Fotiman




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

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.

penders




msg:3587209
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved