Results 1 to 4 of 4

Thread: window_onload()

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Angry window_onload()

    Hello,

    Can anyone please give me some example code of the window_onload() event!?

    I'm not very clued up with Java. Do you just put this event right at the top of your page and it will "fire" whenever the page is loaded??

    What I want to do is set the focus to "textbox1" when the page loads.

    Thanks,
    T

  2. #2
    kayoca
    Guest
    You can use this little tiny script for window_onload()
    Code:
    <title></title>
    <script language=javascript>
    <!--
    
    function window_onload() {
    
    }
    
    //-->
    </script>
    </head>
    And place this code in your body tag.
    Code:
    language=javascript onload="return window_onload()"
    But i dont know how you can focus a object on you pages

  3. #3
    New Member
    Join Date
    Feb 2001
    Posts
    12

    Question

    lo,

    this may be worth a try.

    put this bit in between the <head></head> tags:

    Code:
    <script language="Javascript">
    <!--
    function SetFocus(formfield){
    
    var theForm = document.forms['FORMNAME']
    theForm[formfield].focus();
    
    }
    //-->
    </script>
    Then in the <body> tag add:

    onload="SetFocus('FIELDNAME')"

    just replace the FORMNAME and FIELDNAME with the correct names of the form and field you wish to use.

    Hope that helps, well hope it works tbh

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Talking

    Thanks guys!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width