www.webdeveloper.com
Results 1 to 4 of 4

Thread: function without name?

  1. #1
    Join Date
    Feb 2011
    Posts
    2

    function without name?

    Why the function is without any name, for example - function iAmFunction()

    Code:
    window.onload = function()
    and what's mean this code?

    Code:
    setTimeout(function(){window.scrollTo(0, 1);}, 100);

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    You don't have to name a function in order for it to work; you can just create a function to run. Personally, I think it's easier to name them and call them, but it isn't necessary.

    The second one will automatically scroll to a given co-ordinate 1/10th of a second after instructed to do so.

    ^_^

  3. #3
    Join Date
    Feb 2011
    Posts
    2
    Yout got it. thanks

  4. #4
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles