I am using onload="f();g();document.forms.elements.focus();" in the body tag. F() and g() are other functions that seem to work ok.
When I get to the page from the address bar, the focus goes to the address bar. When I right click and refresh the page, focus goes to the first element like I want.
What could I be doing wrong?
Unless the form presence is dynamically determined, I'd use the name of the form when referencing it; and even then you can use a conditional to check for whether or not the form is present when the page loads.
Instead of using the onload in BODY, try this:
window.onload = init;
Took out the document.forms.elements.focus() from
onload="a(arglist 1);a(arglist 2);document.forms.elements.focus()"
and put in init() etc. No luck and a() did not run.
Maybe body of form not there when page loads though like you suggested.
What could cause that ?
Made it onload="a(args);a(args);startout()" and in startout, put
The * shows whether I start from address bar or right click refresh and whether I use formname or forms etc. But still focusing only ok when refreshing.
What is different about starting from address bar and right click refreshing ?
maybe you have another code which uses also window.onload. Or you can not have more than a single event of one kind on the same element. Check that, and if so, gather all the functions/statements you want to start onload within the same and unique window.onload.
Originally Posted by neginf
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)