question about Onload function ?

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

    #1

    question about Onload function ?

    question about Onload function

    can one define more than one function for Onload ?
    <body Onload="functio n1()">
    or can one define multiple functions one after another
    like <body Onload="f() g() h()" ???

    is there an equivalent function like sleep() in javascript ? so that one
    can delay executions of statements via the sleep ?
  • David Dorward

    #2
    Re: question about Onload function ?

    brian wrote:
    [color=blue]
    > or can one define multiple functions one after another
    > like <body Onload="f() g() h()" ???[/color]

    Yes... but only in the same way that you would usually execute multiple
    functions in sequence (by seperating them with the end of statement
    character ";")

    --
    David Dorward http://dorward.me.uk/

    Comment

    • Lee

      #3
      Re: question about Onload function ?

      brian said:[color=blue]
      >
      >question about Onload function
      >
      >can one define more than one function for Onload ?
      ><body Onload="functio n1()">
      >or can one define multiple functions one after another
      >like <body Onload="f() g() h()" ???
      >
      >is there an equivalent function like sleep() in javascript ? so that one
      >can delay executions of statements via the sleep ?[/color]

      The value of the onLoad attribute is interpretted as the body of
      the onload function. Like any other function, it can contain
      several other function calls, separated by semi-colons:

      onload="f();g() ;h()"

      Event driven systems like web pages and other GUI interfaces generally
      don't provide a sleep(). You always want to be able to detect mouse
      and keyboard activity. Instead, you use setTimeout() to schedule some
      code to be executed after a delay (specified in milliseconds):

      onload="f();g() ;setTimeout('h( )',60000)"




      Comment

      Working...