www.webdeveloper.com
Results 1 to 2 of 2

Thread: onload event

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    onload event

    Hi All,
    Newbie to Javascript and need a bit of help.
    I have a site with lots of pages, all with different body tag ID's. I need to have the following onload event on all pages:
    <body id="body_home" onload="NewsScrollStart('0');"></body>
    This, as you would expect works absolutely fine but is their an easy way of putting this on every page without manually pasting the code into each and every page.
    I was hoping so in case I need to change the onload or add to it at a later date.

    Cheers

    Si

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    You can add something like this to your JavaScript file:
    Code:
    window.onload = function(){
        NewsScrollStart('0');
    }
    It's the same as <body onload="NewsScrollStart('0');"> .
    New to web development or in need of a good reference? Check out the Mozilla Developer Network or W3Schools.

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