C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Javascript »

Javascript( Enter key as a TabKey )....


Posted Date: 18 Nov 2008    Resource Type: Code Snippets    Category: Javascript
Author: seenuMember Level: Gold    
Rating: 1 out of 5Points: 10



Hi!

now i post the javascript(Enter key as a Tabkey).....before you make it Tabindex value.....after call this code.....


< script language="javascript" type="text/javascript" >
function enterToTab(formRef, focusAny) /*2843295374657068656E204368616C6D657273*/
{
for(var i=0, e=formRef.elements, len=e.length, hasNext=true; i < len && hasNext; i++)
if( e[i].type && /^text|password|file/.test( e[i].type ) )
{
for(var j=i+1; j < len && (!e[j].type || /submit|reset/.test(e[j].type)||( focusAny ? /hidden/.test(e[j].type): !/^text|password|file/.test(e[j].type)) ); j++)
;
hasNext = j!=len;

e[i].onkeypress=(function(index, notLast)
{
return function()
{
var ta=false, k=(arguments[0]?arguments[0].which:window.event.keyCode )!=13;

if(!k && !(ta=(this.type=='textarea'&&this.value.length >0)) && notLast)
this.form.elements[index].focus();

return k||ta;
}
})(j, hasNext);
}
}


< /script >




< form id="form1" runat="server" onkeydown="javascript:enterToTab(form1,TextBox1)" >



Responses

Author: Miss Meetu Choudhary    21 Apr 2009Member Level: Diamond   Points : 0
Nice Snippet


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Javascript( Enter key as a TabKey )....  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Formatting the Phone Numbers in Javascript
Previous Resource: Avoiding Postback on keypress in the textbox (Javascript)
Return to Discussion Resource Index
Post New Resource
Category: Javascript


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use