Jump to content

Recommended Posts

hi I need to allocate tab indexes using javascript and use tab+shift to go to the previous selected textbox or select on a dynamically created user interface with 5 contact detailes with 9 select dropdown and 9 textboxes[contact type] [select drop down]space[textbox

Link to comment
https://forums.phpfreaks.com/topic/157224-phpjavascript/
Share on other sites

My problem is to show the next textbox or select dropdown and put the focus on the displayed select or textbox and assigning the tab index on the currect displayed but when shift+tab clicked its must tab back using tabindex and setting the focus to the previous

Link to comment
https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833081
Share on other sites

maybe the code bellow will clarify the problem I have.

 

function ShowTabIndex(text,next,current,previous,e,contact_count,detailed_count)

{

 

var out_count = 0;

var middle_count = 0;

var inner_count = 0;

 

var previous = document.getElementById(previous);

var next = document.getElementById(next);

var current = document.getElementById(current);

 

var index = 0;

 

index = document.getElementById("txtknown_name").tabIndex + 1;

    //shows the next textbox or select dropdown

    if(text.length > 3 || text > 0)

{

next.style.display = 'inline';

//next.focus();

}

 

var infor_id;

var selected_id;

//this one determines the tabIndex and then sets the focus() to next showed textbox or select dropdown

for(var count = 1;count <= detailed_count ;count++)

{

for(var ct = 1 ;ct <= 9 ;ct++)

{

if(current.style.display == 'inline')

{

var info_id = document.getElementById("txt1_"+count+"_"+ct);

var sel_id = document.getElementById("sel1_"+count+"_"+ct);

 

if(current.style.display == 'inline')

{

index++;

infor_id= document.getElementById("txt1_"+count+"_"+ct).id;

infor_id.tabIndex = index;

//infor_id.tabIndex = infor_id.focus();

//alert(document.getElementById("txt1_"+count+"_"+2).tabIndex);

//info_id.tabIndex = info_id.focus();

}

else if(sel_id.style.display == 'inline')

{

index++;

selected_id =  document.getElementById("sel1_"+count+"_"+ct).id;

selected_id.tabIndex = index;

//info_id.tabIndex = info_id.focus();

//alert(sel_id +": "+index);

}

}

}

//next.focus();

//alert(document.getElementById("sel1_5_2").tabIndex);

 

}

 

alert(selected_id.tabIndex);

}

 

 

Link to comment
https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833243
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.