Results 1 to 9 of 9

Thread: JS does not render CSS

  1. #1
    Join Date
    Oct 2005
    Posts
    63
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default JS does not render CSS

    1) Script Title: DDTab menu
    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm

    3) Describe problem: Attempted to customise the tab memu.
    files uploaded to server,but the CSS does not display the tabs

    http://freelinksexchange.net/ddtabme...ddtabmenu.html

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The paths to the .js and .css files of the script on your page appears to be broken. Make sure they are correct, that is, correctly references the two files on yours server.
    DD Admin

  3. #3
    Join Date
    Oct 2005
    Posts
    63
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default

    All files are in the same directory
    ddtabmenufiles/ddtabmenu.css
    ddtabmenufiles/ddtabmenu.js

    Change from relative to absolute urls reflects no change

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmm that's strange. What happens if you directly add the CSS to the page in the HEAD section of your page:

    Code:
    <style type="text/css">
    
    .basictab ul{
    margin: 4px;
    padding: 3px 0;
    margin-left: 0;
    font: bold 12px Verdana;
    border-bottom: 1px solid gray;
    list-style-type: none;
    text-align: left; /*set to left, center, or right to align the menu as desired*/
    }
    
    .basictab li{
    display: inline;
    margin: 0;
    }
    
    .basictab li a{
    text-decoration: none;
    padding: 3px 7px;
    margin-right: 3px;
    border: 1px solid gray;
    border-bottom: none;
    background-color: #f6ffd5;
    color: #2d2b2b;
    }
    
    .basictab li a:visited{
    color: #2d2b2b;
    }
    
    .basictab li a:hover, .basictab li a.current{
    background-color: #DBFF6C;
    color: black;
    }
    
    .basictab li a:active{
    color: black;
    }
    
    .tabcontainer{
    clear: left;
    width:95%; /*width of 2nd level sub menus*/
    height:1.5em; /*height of 2nd level sub menus. Set to largest's sub menu's height to avoid jittering.*/
    }
    
    .tabcontent{
    display:none;
    }
    
    </style>
    BTW, there's an error in your JavaScript code. The following lines in red should be removed, as you're only showing one menu:

    Code:
    <script type="text/javascript">
    //SYNTAX: ddtabmenu.definemenu("tab_menu_id", integer OR "auto")
    ddtabmenu.definemenu("ddtabs1", 0) //initialize Tab Menu #1 with 1st tab selected
    ddtabmenu.definemenu("ddtabs2", 1) //initialize Tab Menu #2 with 2nd tab selected
    ddtabmenu.definemenu("ddtabs3", 1) //initialize Tab Menu #3 with 2nd tab selected
    ddtabmenu.definemenu("ddtabs4", 2) //initialize Tab Menu #4 with 3rd tab selected
    ddtabmenu.definemenu("ddtabs5", -1) //initialize Tab Menu #5 with NO tabs selected (-1)
    
    </script>
    DD Admin

  5. The Following User Says Thank You to ddadmin For This Useful Post:

    dbldee (04-12-2009)

  6. #5
    Join Date
    Oct 2005
    Posts
    63
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default

    With the CSS added to the head section, the style is displayed, however the contents of the 2nd level do not display.
    NB since files are in the same directory the script could be called directly
    <script type="text/javascript" src="ddtabmenu.js">

  7. #6
    Join Date
    Oct 2005
    Posts
    63
    Thanks
    5
    Thanked 1 Time in 1 Post

  8. #7
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    IE doesn't support XHTML, try using a HTML doctype:
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    Good luck!

  9. The Following User Says Thank You to Snookerman For This Useful Post:

    dbldee (04-22-2009)

  10. #8
    Join Date
    Oct 2005
    Posts
    63
    Thanks
    5
    Thanked 1 Time in 1 Post

    Default Code invalid

    The pages now renders in both FF3 and IE8, but for some unknown reason, the html code appears as invalid and cannot be edited in editor?

    Suggestions appreciated

  11. #9
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Do you mean it doesn't validate? Just remove the selfclosing tag here:
    Code:
    <link rel="stylesheet" type="text/css" href= "ddtabmenu.css" />
    so it looks like this:
    HTML Code:
    <link rel="stylesheet" type="text/css" href= "ddtabmenu.css">
    and then change this:
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    to this:
    HTML Code:
    <html lang="en">
    Now it should validate.

    Good luck!

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
  •