Simple onload for my js.file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nody

    Simple onload for my js.file

    I am trying figure out how to add body onload for external js file.
    All the examples i found are more than i what i need.

    Any help would be appreciated.
  • Tom de Neef

    #2
    Re: Simple onload for my js.file

    "Nody" wrote:
    >I am trying figure out how to add body onload for external js file.
    All the examples i found are more than i what i need.
    >
    <HTML>
    <HEAD>
    ...
    <SCRIPT src="YourScript File.js" type="text/javascript"></SCRIPT>
    </HEAD>
    <BODY onload="initial ize()"// where function initialize() must be defined
    in YourScriptFile
    ...
    </BODY>
    </HTML>

    Tom


    Comment

    • Nody

      #3
      Re: Simple onload for my js.file

      On Mar 19, 3:40 am, "Tom de Neef" <tden...@qolor. nlwrote:
      "Nody" wrote:
      I am trying figure out how to add bodyonloadfor external js file.
      All the examples i found are more than i what i need.
      >
      <HTML>
      <HEAD>
      ...
      <SCRIPT src="YourScript File.js" type="text/javascript"></SCRIPT>
      </HEAD>
      <BODYonload="in itialize()"// where function initialize() must be defined
      in YourScriptFile
      ...
      </BODY>
      </HTML>
      >
      Tom
      I cannot alter the java script. How can i get the page to load first
      and then execute the script. Maybe some type of delay method.

      Many Thanks

      Comment

      • Tom de Neef

        #4
        Re: Simple onload for my js.file

        "Nody" wrote:
        >
        I cannot alter the java script. How can i get the page to load first
        and then execute the script. Maybe some type of delay method.
        >
        I think that your js file will be loaded as part of the loading of the htm.
        That may result in the initialization of global variables - I guess you can
        not stop that.
        You can change the onload call of <bodyso that your own function is
        executed rather than the original one. In that own function you would have
        to mess around with a timer which calls the original function. But I do not
        know enough about timers to judge if this can achieve your goal.
        Tom


        Comment

        Working...