napsternapster Posted May 7, 2009 Share Posted May 7, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/ Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Okay...? So what's the trouble you're having? Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-828527 Share on other sites More sharing options...
napsternapster Posted May 13, 2009 Author Share Posted May 13, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833081 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Alright. Are there any errors in the code or what? Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833219 Share on other sites More sharing options...
napsternapster Posted May 13, 2009 Author Share Posted May 13, 2009 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); } Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833243 Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 1. Use tags. 2. I asked if there are any errors because I'm not psychic. You asked for help because the code doesn't work so by posting it without explaining what doesn't work doesn't help clarify anything. Quote Link to comment https://forums.phpfreaks.com/topic/157224-phpjavascript/#findComment-833253 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.