www.webdeveloper.com
Results 1 to 6 of 6

Thread: Odd placement requirement.

  1. #1
    Join Date
    Sep 2004
    Posts
    5

    Odd placement requirement.

    I'm using some Javascript libraries to utilize RGB slider objects on my site.

    This really isn't a problem, more of a perculiarity. The code only works in Mozilla and Safari if the tags to include the library scripts are at the VERY top of the page, and nowhere else. I've tried putting them lower in the page, or inside the <head> tag, or even just below the <html> tag, but they all make the code dysfunctional.

    <script type="text/javascript" src="LibCrossBrowser.js"></script>
    <script type="text/javascript" src="EventHandler.js"></script>
    <script type="text/javascript" src="Bs_FormUtil.lib.js"></script>
    <script type="text/javascript" src="Bs_Slider.class.js"></script>

    http://iologs.com/basic.html

    Does anyone know why that is?

  2. #2
    Join Date
    Jul 2004
    Posts
    986
    You can only have one onload event....

    My guess is one or more of the numerous other external javascript files are also using onload events, thus cancelling any which may be present in your slider's external scripts....

    .....Willy

  3. #3
    Join Date
    Sep 2004
    Posts
    5
    Yeah, I guess that makes sense.

    I only figured out what the problem was by chance. If I hadn't moved the script tags to the top I never would have figured it out.

  4. #4
    Join Date
    Jul 2004
    Posts
    986
    Did you fix the problem?

    Or merely ignore the underlying problem because removing the externals scripts from the flow of the document and placing them above/outside the document appears to fix the problem....

  5. #5
    Join Date
    Sep 2004
    Posts
    5
    I admit, it's probably voo-doo coding, but it makes it function flawlessly in all the major browsers. I'm not an Javascript expert, but I have spent way too much time fixing trivial JS issues to bother with this.

    Either way, like I said, putting it at the top of the page isn't a problem for me.
    Last edited by non_zero; 09-25-2004 at 05:44 AM.

  6. #6
    Join Date
    Sep 2004
    Posts
    5
    Just figured out the problem. Apparently it doesn't work with an XHTML doctype.

    That's why it worked when I placed the script tags before declaring the doctype.

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