Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Are you allowed to call to javascript body onloads on a single page?

    Hello all ,are you allowed to call to javascript body onloads on a single page?

    Code:
    <body onload="Populate(''VisibleId'',DropBoxArray,''ShowOrHide'')" onLoad="document.UpdateDataRequest.p_target_date.focus()">



    thanks

  • #2
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    meant to say 2 (two) instead of "to"

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I found out the answer by playing with it myself . You have to separate each onload function call that you choose to use with a semicolon.

    example:

    Code:
    <body onload="Populate(''VisibleId'',DropBoxArray,''ShowOrHide'');document.UpdateDataRequest.p_target_date.focus()">

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    in fact is better to separate content from javascript control codes. The proper way is to place your javascript code in the HEAD of the page, and use onload event there with an anonymous:

    <script type="text/javascript">
    ......functions, code lines, and so on......
    onload=function(){
    myFunc1(param1,param2);
    myFunc2(param3);
    ... othe statemens, functions, and so on
    }
    </script>
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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