Jump to content

<li> and onKeyDown


RIRedinPA

Recommended Posts

I'm trying to capture when the user clicks the "tab" key but am having no luck. Not getting any error messages but no alert either. Here's the code:

 

function tabcheck(e) {
		var evt = e || window.event
		if (evt.keycode == 9) {
			alert("ok"); 
		}
	}

 

I'm building the <ul> list programmatically from a MySQL db...

 

<li onmousedown=\"updatedb('" . $thisid . "');\" onmouseover=\"changebg('R" . $c . "C" . $f1 . "', 'over');\" onmouseout=\"changebg('R" . $c . "C" . $f1 . "', 'out');\"onKeyDown=\"tabcheck(event);\" id=\"R" . $c . "C" . $f1 . "\">" . $value . "</li>

Link to comment
Share on other sites

Wouldn't it make more sense to tie the event to the document as a whole?

 

I should have provided more background:

 

This is for a site that shows the workflow of magazine production. Each section/feature in the magazine has to go through the same series of checks (edit review, copy dropped, etc. etc.). We have teams of editors and teams of designers and this site allows them to document the progress of each section and leave comments/notes etc. My v1 was laid out in two tables, headers in one, content in another. I had a ton of issues (and still have) getting all the cells to line up.

 

Started working on v2 and using thead and tbody tags but not all browsers want to play nice there either. I'm tinkering now with abandoning the table layout all together and simulating one with <div><ul><li>.....</ul></div> and some css and laying the list out horizontally. So far it works so much better, it seems a lot smoother. What I am missing though is the ability to tab through the "cells"...I id each <li> with a R#C# so I can track where the user is within the ul/li grid...so what I am trying to do is when a user clicks tab to make the next sequential grid cell active

 

 

Link to comment
Share on other sites

AFAIK, list items aren't focusable, so they can't be tabbed.  What can be tabbed are the elements inside them, depending on what they are.  Try attaching the tracking to the items within the list items.

 

Thanks, that'll save me hours of barking up the wrong tree, I could put input items inside which can also be indexed

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.