Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I think this is an HTML problem body onload not working on Firefox

    This page loads fine using IE, but not Firefox.
    looks like the "body onload" is not running when I open it in firefox. (I don't think this is a java problem, but may be).
    Div id company is displayed.
    Div id products should but is not.
    Div id Articles is not displayed.

    Any one have any ideas, have searched for about an hour and found nothing.

    PS. I did pull out the CSS link.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    
    <script language="javascript" type="text/javascript">
      function showsubmenu() {
        document.all.Products.style.display ='block';
      }
    </script>
    </head>
    <body onload="showsubmenu()">
      <DIV CLASS="menu">
        <ul>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/index.php'>Home</a></li>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/company/index.php'>Company Info</a></li>
            <div id="Company" style="display: block;">
              <ul class="submenu">
    			      <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/'>Company Directory</a></li>
    				    <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/company/#.php'>Sales Territory Map</a></li>
              </ul>
    		  	</div>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/dealer/index.php'>Dealer Locator</a></li>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/products/index.php'>Products</a></li>
            <div id="Products" style="display: none;">
              <ul class="submenu">
                <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/products/#.php'>Beef Cattle</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/products/#.php'>Dairy Cattle</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/products/#.php'>Horses</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/products/#.php'>Goats</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/products/#.php'>Sheep</a></li>
                <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/products/#.php'>Wildlife</a></li>
              </ul>
            </div>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/articles/index.php'>Articles</a></li>
            <div id="Articles" style="display: none;">
              <ul class="submenu">
                <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/articles/#.php'>Cattle</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/articles/#.php'>Goats</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/articles/#.php'>Horses</a></li>
                <li class='submenu'><a CLASS='submenu' href='http://jimm/sweetlix/articles/#.php'>Sheep</a></li>
                <li class='submenu'><a class='submenu' href='http://jimm/sweetlix/articles/#.php'>Forages</a></li>
              </ul>
            </div>
          <li class='menu'><a class='menu' href='http://jimm/sweetlix/contact/index.php'>Contact</a></li>
        </ul> 
      </DIV>
    </body>
    </html>
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    This is a JavaScript problem. Firefox doesn't recognise:
    Code:
    document.all.....
    You have to use document.getElementById(".....") in order for it to work.
    I presume everything but the menu works.

    Hope this helps
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #3
    Senior Coder JamieR's Avatar
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    3,161
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by musher
    Div id company is displayed.
    Div id products should but is not.
    Div id Articles is not displayed.

    PS. I did pull out the CSS link.
    I thought to use <div id="whatever></div> with CSS to pull the CSS attributes for "whatever" out of the css file and display it

  • #4
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    This line is for Opera, IE and Konqueror only:

    document.all.Products.style.display ='block';

    This works with the above browsers and Gecko-based browsers like Netscape and Firefox:

    document.getElementById('Products').style.display ='block';

    Just replace the first with the second line.

    HTH

  • #5
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey thanks guys
    The document.getElementById fixed the problem, gosh another new thing learned today (brain is hurting again)

    Originally Posted by musher
    Div id company is displayed.
    Div id products should but is not.
    Div id Articles is not displayed.

    PS. I did pull out the CSS link.
    Originally Posted by weazel
    I thought to use <div id="whatever></div> with CSS to pull the CSS attributes for "whatever" out of the css file and display it
    Jamie
    I pulled out the linked CSS file so most of the styling was missing, Just didn't want some one to question why I had a bunch of classes in my code and no CSS to go along with it. Each of my Divs does have an "ID" and a style="display: block;" to initialy hide them.



    PS...... when u do a quote how do you get the (Originally Posted by Name) in there, i've been doing it by hand is there an automatic way to do this.
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #6
    Senior Coder JamieR's Avatar
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    3,161
    Thanks
    0
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by musher
    PS...... when u do a quote how do you get the (Originally Posted by Name) in there, i've been doing it by hand is there an automatic way to do this.
    When you click on quote the previous post you are quoting on will be in the form body where you are typing your reply. To keep the "Originally Posted by.." you just need to keep the [1QUOTE=musher]the post here[/QUOTE]
    Then type your post underneath.
    I put the 1 in the opening quote tag otherwise VBulliten will parse it as a quote.


  •  

    Posting Permissions

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