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
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts

    Doctype Breaks Menu

    I'm sorta undecided to post here or in the ajax or even php forums. I'm looking to create a nice slide in menu that will get its links (likely both headers and actual links) from a database. I hope to eventually use the menu in conjunction with vbulletin forums.

    If something similar already exists, I would be very interested in seeing a demo of some kind.

    So in doing some searches, I did find this nice javascript menu to start working on modifying.

    http://simplythebest.net/scripts/DHT...script_54.html

    Now, on some local testing, the menu will slide nicely in and off the page. But the minute I add a doctype to the page, the menu stops working. As I'm pretty clueless with javascript, would anyone know why that would occur?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Tables are really bad for layout!
    You should have a valid DOCTYPE before all documents.
    After all, your document must be a valid one.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Thanks for the help/tip, and while I agree that tables are not the best of approaches, I'm working with what I have at the moment. I didn't create the slide in menu, but am going to try and modify it fit my needs.

    And yes, a DocType should be on each and every page. And like my initial question. When I add any doctype to the beginning of the page, the menu will stop working, no longer sliding in an off the page correctly.

    So why would adding a doctype cause the javascript to stop working? Are you trying to say that the use of tables is actually breaking the menu when adding a DocType?

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    When there is no DOCTYPE, the borwser renders the page in quirks mode, and you may get some result, which may be proper or improper, depending on the browsers rendering engine.

    But, when there is avalid DOCTYPE, the browser would turn in to standard mode and the rendering will be based on that DOCTYPE. Thus, you'll get a uniform display across browsers. But, you need to provide a valid set of tags now. So add a proper DOcTYPE and then validate your code and fix the errors in your markup.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    it works for me in IE
    with doc type
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    BUT
    The script is old and does not work in Moz browsers

    needs a complete rework
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Quote Originally Posted by vwphillips View Post
    BUT, The script is old and does not work in Moz browsers

    needs a complete rework
    And who in their right mind would use IE these days anyway? I use Moz and Opera almost exclusively.

    Maybe I'll try and rework it, but JS is definitely not my strong suit.

    Again, I would really like something similar that is done with php and ajax to work with a database for its links. But until I find something like that, I'm stuck trying to modify this one.
    Last edited by ptmuldoon; 10-16-2008 at 07:33 PM.


  •  

    Posting Permissions

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