I have implemented a javascript function called FocusChange() in my aspx page to allow for easy navigation between controls by hitting the enter key. While it works perfectly fine in IE7, I am facing issues with IE8. Can anyone provide me with some guidance on this matter?
Thank you in advance for your assistance. Below is the snippet of the javascript code:
function FocusChange() {
if (window.event.keyCode == 13) {
var formLength = document.form1.length;
var src = window.event.srcElement;
var currentTabIndex = src.getAttribute('tabindex');
// Loop through all form elements and set focus on field with next tabindex
for (var i = 0; i < formLength; i++) {
if (document.form1.elements[i].getAttribute('tabindex') == currentTabIndex + 1) {
for (var j = i; j <= formLength; j++) {
if (document.form1.elements[j].disabled == false) {
document.form1.elements[j].focus();
event.returnValue = false;
event.cancel = true;
return;
}
}
}
}
}
}