Hi,
i have a page that when the enter key is pressed it moved down to the next textbox.
It works good for windows netscape/ie and mac ie but when I test it on a mac using safari when the enter key is pressed the whole page refreshes and any information that is entered is lost.
I have caught the enter key by the following code.
Does anyone know why only mac safari would be reloading the page and how to stop it from happening.
A sample of how I set up the textboxes
any help would be appreciated
i have a page that when the enter key is pressed it moved down to the next textbox.
It works good for windows netscape/ie and mac ie but when I test it on a mac using safari when the enter key is pressed the whole page refreshes and any information that is entered is lost.
I have caught the enter key by the following code.
Does anyone know why only mac safari would be reloading the page and how to stop it from happening.
Code:
var nextGrade, netscape, ver, len, iln;
var inputField;
nextField= "txtField-99";
netscape = "";
ver = navigator.appVersion;
len = ver.length;
for(iln=0; iln < len; iln++){
if (ver.charAt(iln) == "(")
break;
}
netscape = (ver.charAt(iln+1).toUpperCase() != "C");
function keyDown (DnEvents){
var key;
key = (netscape) ? DnEvents.which : window.event.keyCode;
if (key == 13){ //the enter key
if (nextField == 'txtField-99'){
return true;
}
else{
try{
eval('window.document.gbIndvGradesEntryMiddle.' + nextField+ '.select()');
}
catch(er){
alert("Cannot move to next Field.");
}
return false;
}
}
}
document.onkeydown = keyDown;
A sample of how I set up the textboxes
Code:
<input type="text" name = "<%=cstr("txtField" & trim(rs4.Fields("cFieldid")))%>" id = "<%=cstr("txtField" & trim(rs4.Fields("cFieldid")))%>"
value= "<%=nValue%>"
onblur="FieldCheck(this,'<%=iID%>');" onFocus="nextField='txtField<%=iID%>';">
any help would be appreciated