SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rollover question -> loadtime?

    Let's say I got a rollover script (Javascript with functions such as image preload,swap image, restore image etc) that appears in my <head> section

    If i put these codes in a JS file and then mypage.htm to this external file via

    <link href="myJS.js" type="text/javascript">
    .

    So...my question is :

    When someone hovers over the menu or whatever has a rollover, is it gonna take a longer time for the rollover image to appear? or should i just leave the contents of the .js above in the <head> section?

    I cant find the right lingo...but you get the idea right?

    I'll be back to explain more if needed.

    asT.

  2. #2
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It shouldn't affect it at all.
    Mike
    It's not who I am underneath, but what I do that defines me.

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    It used often could be faster.

    As the .js is loaded the first time a client visits, it will be placed in their tempory internet folder, where it is called from next time it is asked for.

    So if you have a common function or rollover for multiple pages then using it in an external .js does make it faster.

    I am creating html and css only pages for ALL browsers for my site, but compared to the javascript created document the HTML files are massive!

    I have to write the same data for every page.

    If you are having a javascript-enabled site I recommend puting EVERTHING common to your site that doesn't need to be picked up by search engines into an external .js.
    It will save you memory and time, AND download speed.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  4. #4
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    And...........

    The document is read from top to bottom, so if you put the .js link at the top of your HTML it will do the link first. This is also read and executed from top to bottom.
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  5. #5
    My precious!!! astericks's Avatar
    Join Date
    Mar 2002
    Location
    Vancouver, BC
    Posts
    1,971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies narra and Mark...very much appreciated.

    asT.


Bookmarks

Posting Permissions

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