SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onLoad js call NOT in body tag? Is there a way?

    Hoo boy... I'm really struggling with this one... I'm building an ecommerce store that will not allow me access to the <body tag... Is there any way to load the onLoad js call another way?

    I tried putting a layer with a high z-index and a clear pixel stretched out in it... I've tried the call as onLoad and as mouseover... I can't get it to work. What am I missing? If you'd like to see my mess, it's here:

    http://www.lacrossespecialties.com/M...&Store_Code=LS

    Of course, since I can't get the onLoad call to work yet, it's not showing the left nav bar... but you can see my final try at the js cal on the clear pixel...

    Thanks in advance for any suggestions...
    Stephanie Sullivan
    VioletSky Design
    http://violetsky.net

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, it is actually really easy, simple inside the HTML of the page, add the block of script that you want to execute.

    Say for example it was a function, you would have the function in the <head> of the document, and then some where in the HTML you would have a call to the function like this:

    Code:
    HTML Stuff
    <script language="javascript">
       makeVis()
    </script>
    remaining HTML stuff
    So when the browser loaded that section of the page, teh function will be called

  3. #3
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by dhtmlgod

    Say for example it was a function, you would have the function in the <head> of the document, and then some where in the HTML you would have a call to the function like this:

    Code:
    HTML Stuff
    <script language="javascript">
       makeVis()
    </script>
    remaining HTML stuff
    So when the browser loaded that section of the page, teh function will be called [/B]
    OK... I have the function in a .js document that's called from the head of the html document... but I need it to happen "onLoad" ... and that's the problem... It seems if I put anything in the body, my layers don't load... here's all I need to happen onLoad... how would I write this? I'm new to tweaking javascript... more of a designer.. :-P

    Code:
    <body onLoad="P7_autoLayers('leftnavmain')">
    That's what I need to happen... seems simple enough... just can't get it to work outside the body tag...

    Thanks...
    Stephanie Sullivan
    VioletSky Design
    http://violetsky.net

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stick this code either in your included js file or in your main file in the head outside the body tag.

    Code:
    window.onLoad = P7_autoLayers('leftnavmain');
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


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
  •