onFocus and safari/chrome?

I’m trying to make this autotab script which works fine now except in chrome and safari… It seems that the onFocus command doesn’t work here?

Here is my script:

function stroke_calc() 
{
var i,s=[];
for (i=0; i<=17; i++)
{
  s[i]=validNum(document.form2["stroke"+i].value);
}
var s_out = s[0] + s[1] + s[2] + s[3] + s[4] + s[5] + s[6] + s[7] + s[8]; 
var s_in = s[9] + s[10] + s[11] + s[12] + s[13]+ s[14] + s[15] + s[16] + s[17]; 

document.form2.stroke_out.value = s_out;
document.form2.stroke_in.value = s_in;
document.form2.stroke_total.value = s_out + s_in;
}

//var keyCode = e.which || e.keyCode;
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input, e) {
	//var keyCode = e.which || e.keyCode;
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if (input.value == 1) {
		if(input.value.length >= 2 && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, 2);
			input.form[(getIndex(input)+1) % input.form.length].focus();
			input.form[(getIndex(input)+1) % input.form.length].select();
		}
	} else {
		if(input.value.length >= 1 && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, 2);
			input.form[(getIndex(input)+1) % input.form.length].focus();
			input.form[(getIndex(input)+1) % input.form.length].select();
		}
	}
}

function containsElement(arr, ele) {
	var found = false, index = 0;
	while(!found && index < arr.length)
	if(arr[index] == ele)
	found = true;
	else
	index++;
	return found;
}
function getIndex(input) {
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
	if (input.form[i] == input)index = i;
	else i++;
	return index;
}
//return true;
//}
// Makes sure variable is a number
function validNum(nmbr)
{
// forces variable into integer type
nmbr = (nmbr * 1);

// Checks if variable is Not a Number
if(!isNaN(nmbr))
// If a number, return value
return nmbr;
else
// If not a number, return zero
return 10;
}

And then the HTML/PHP:

echo '<form name="form2">';

for ($i = 0; $i <= 8; $i++) {
	echo '<input name="stroke'.$i.'" onKeyup="stroke_calc();autoTab(this, event);" class="style1" value="'.${'stroke'.$i}.'" maxlength="2"><br>';	
}
echo '<input name="stroke_out" readonly=true class="style2" value="0" onFocus="this.form.stroke9.focus();"><br>';
for ($i = 9; $i <= 17; $i++) {
	echo '<input name="stroke'.$i.'" onKeyup="autoTab(this, event);stroke_calc();" class="style1" value="'.${'stroke'.$i}.'" maxlength="2"><br>';
}
echo '<input name="stroke_in" readonly=true class="style2" value="0"><br>';
echo '<input name="stroke_total" readonly=true class="style2" value="0"><br>';

echo '</form>';

As you can see I want to be able to jump “over” the field called “stroke_out” by using this: onFocus=“this.form.stroke9.focus();” but it doesnt work in safari/chrome…

I have scouted the net but havent found the solution… Hoping 4 help :wink: