Results 1 to 2 of 2

Thread: Validating Accordion Content init

  1. #1
    Join Date
    Jul 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Validating Accordion Content init

    1) Script Title: Accordion Content script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.htm

    3) Describe problem: Validating the ddaccordion.init

    Hi there, I'm using this to display a menu and have implemented the plus and minus graphics in the 'statusicon' class placed within the togglehtml line of the init as follows...

    Code:
    <script type="text/javascript">
    
    ddaccordion.init({
            headerclass: "submenuheader", //Shared CSS class name of headers group
            contentclass: "submenu", //Shared CSS class name of contents group
            revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
            collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
            defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
            onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
            animatedefault: false, //Should contents open by default be animated into view?
            persiststate: true, //persist state of opened contents within browser session?
            toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
            togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' alt='open icon' />", "<img src='images/minus.gif' class='statusicon' alt='close icon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    				
            animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
            oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
                    //do nothing
            },
            onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
                    //do nothing
    		if(state == "block"){
    		   header.id = "active";
    		} else {
    		   header.id = "";
    		}        }
    })
    
    
    </script>
    The problem I'm having is that when I try and validate the page, the only two errors I get are that it doesn't allow an IMG element in this area. The page is XHTML Transitional and UTF-8.

    I would be grateful for any advice to help resolve this issue.
    Many thanks in advance.
    Paul

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

    Default

    It's most likely referring to the IMG tag that's specified in your inialization code above, thinking that line is actually markup when it's just a variable assignment:
    Code:
    togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' alt='open icon' />", "<img src='images/minus.gif' class='statusicon' alt='close icon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    You can try escaping the opening "<" and closing ">" tags above and use their HTML entities equivalent, though I'm not sure if the image will still be shown as a result.
    DD Admin

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
  •