|
Posted by Jeff on March 20, 2009, 11:33 am
Please log in for more thread options T.J. wrote:
show/hide quoted text
>
>> T.J. wrote:
>>> I have a page with an input form
>>> Is there a way of having the cursor
>>> automatically positioned in the imput box
>>> when the page is opened?
>> You should stop wanting this. I frequent a number of sites that do
>> this and it is extremely annoying more often than not.
>> If the page takes a while to load, I'm more likely to be halfway
>> through the form/page before it's fully loaded. Then when the onload
>> function finally kicks in the page jumps back to the designated field,
>> I lose my place and sometimes lose the info I had already keyed in. It
>> can be frustrating as hell.
>> --
>> Berg
>
>
> Thanks, but I only have 1 input box on the page.
> I'm using the page in a similar way as google have theirs.
Just a note that you don't have to use onload, you can include the
javascript right after the form element. All you need is for the element
to be rendered first.
show/hide quoted text
<form name="my_form" ..>
<input type="my_field">
show/hide quoted text
<script type="text/javascript">
document.forms['my_form']['my_field'].focus();
show/hide quoted text
</script>
...
Never had need to do this myself.
Jeff
show/hide quoted text
>
|
> Is there a way of having the cursor
> automatically positioned in the imput box
> when the page is opened?