i am getting the error as "Can't move focus to the control because it is incisible, not enabled , or a type that does not accept the focus" ,when i am trying open the login page

plz help to give suggestions to solve this problem.
and my scipt is

function focusFunction()
{
  document.getElementById('username').focus();
}

Show html code of login page.

ensure that the element that u are referring to has loaded before the "focusFunction" function is called

Also make sure that the element you are trying to focus can be display (not hide or invisible) to the page. If its style display is 'none' or visibility is 'hidden', you could get the error. In addition, if the element has 'disable' property set, it cannot be focus as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.