JS回车实现Tab功能

 

 

//用回车跳到下一个输入框,用法:在<table>中加onkeydown="nextInput(event);"
function nextInput(event)
{
    if(goNextPublic){
		var objectType = event.srcElement.type;
		if(event.keyCode==13 && objectType!='button' && objectType!='submit' && objectType!='reset' 
			&& objectType!='textarea' && objectType!='')
			{			
				var nextObject = event.srcElement.nextSibling;
				if (nextObject!=null && nextObject.type=='button' && nextObject.outerHTML.indexOf('dateinput(') > 0){
					nextObject.focus();
					event.keyCode=9;
				} 
				else {
					event.keyCode=9;
				}
		}
    }
	goNextPublic = true;
}

 

你可能感兴趣的:(tab)