火曜日, 1月 16, 2007
[JavaScript]
currentElementNo = 0;
function nextElement( keyCode ) {
if (keyCode == 13) {
currentElementNo++;
currentElementNo %= document.formA.elements.length;
if ( document.formA.elements[currentElementNo].type != 'button') {
document.formA.elements[currentElementNo].focus();
} else {
currentElementNo++;
}
}
}
HTML部
'<'body onkeydown="nextElement(event.keyCode); return true;">
function nextElement( keyCode ) {
if (keyCode == 13) {
currentElementNo++;
currentElementNo %= document.formA.elements.length;
if ( document.formA.elements[currentElementNo].type != 'button') {
document.formA.elements[currentElementNo].focus();
} else {
currentElementNo++;
}
}
}
HTML部
'<'body onkeydown="nextElement(event.keyCode); return true;">