Testing focus() for file input fields - B

The following form is for testing the keyboard tabbing behavior of different form fields. Especially the <input type="file"> shows some strange behavior. Trying to set the focus on such field programmatically (see JavaScript below) doesn't seem to work. However, it does work with other input fiels, which you can try by uncommenting the second line in the JavaScript code.

window.onload = function(){
    document.getElementById("file_field_1").focus();
  //document.getElementById("checkbox2").focus();
    window.location.hash = "#file_field_2";
}

Strangely, using the input field's id as a named anchor, does work: The link at the botom of the page will set the focus to the second file field, whereas the submit button (via the form action) will set the focus to the first file field.

File Upload

Enter your name:

Upload the 1. file:

Check it out:

Upload the 2. file:

Radio activity:

Save:

Clicking this link will bring you back to the second file upload field!