function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shravya Rama 9Shravya Rama 9 

Focus on an inputfield after refresh by action support

In the following VF page, I use action support to refresh a page. But everytime the page refreshes, focus goes to top of the page. I want to set the focus to one of the field Automatik__c with ID = "FocusID" using script whenever the page refreshes. But its not working.
<script type="text/javascript">
    function addLoadEvent(func) { 
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
    function setFocus() {
             <apex:pageBlockSection >
                  <apex:inputField value="{!res.Automatik__c}"   >
                         <apex:actionSupport event="onchange" action="{!getRefresh}" id = "FocusID" >
                    <apex:inputField value="{!res.Navigation__c}" id="ButtonId" >
                   <apex:actionSupport event="onchange" action="{!getRefresh}" >
Can somebody suggest whats wrong with my code or anyother work around. Thank you.