Enter to tab script help

Hi All

I have be using the below javascript for a few years now but the latest update from google chrome has stopped it from working. I could never get it to work in either IE or firefox. Is there a fix for this so I can get it working again in google chrome? or is there a better one out there?.

enterAsTab = function(){
	function next(e){
		var l, i, f, j, o = e.target;
		if(e.key == 13 && !/textarea|select/i.test(o.type)){
			for(i = l = (f = o.form.elements).length; f[--i] != o;);
			for(j = i; (j = (j + 1) % l) != i && (!f[j].type || f[j].disabled || f[j].readOnly || f[j].type.toLowerCase() == "hidden"); );				
			e.preventDefault(), j != i && f[j].focus();
		}
	}
	for(var f, i = (f = document.forms).length; i; addEvent(f[--i], "keypress", next));
};

and then I insert the following into a php page

<script type="text/javascript">


enterAsTab();


</script>

Thanks

Rob.