document type does not allow element "img" here

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jeevan M
    New Member
    • Dec 2011
    • 1

    document type does not allow element "img" here

    I try to validate my xhtml and i have a little problem with this:

    <script type="text/javascript">

    var faq=new switchicon("ico ngroup1", "div") //Limit scanning of switch contents to just "div" elements
    faq.setHeader(' <img src="minus.jpg" alt="Content Management System" />', '<img src="plus.jpg" alt="Content Management System" />') //set icon HTML
    faq.collapsePre vious(true) //Allow only 1 content open at any time
    faq.setPersist( false) //No persistence enabled
    faq.defaultExpa nded(0) //Set 1st content to be expanded by default
    faq.init()

    </script>

    while i validate i am getting the following errors
    document type does not allow element "img" here

    i am also used
    <![CDATA[ ---- ]]>
    If i use this my script not working kindly help me
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    You are asking for HTML help but show javascript. We need the resulting HTML to help you and what little you show in the js is not helpful.

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      hi Jeevan,
      try using the cdata inside the javascript tag like this , and i assume that you have included this script tag inside the <head> tag ,
      Code:
       <script type="text/JavaScript">
              //[CDATA[
      var faq=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
      faq.setHeader('<img src="minus.jpg" alt="Content Management System" />', '<img src="plus.jpg" alt="Content Management System" />') //set icon HTML
      faq.collapsePrevious(true) //Allow only 1 content open at any time
      faq.setPersist(false) //No persistence enabled
      faq.defaultExpanded(0) //Set 1st content to be expanded by default
      faq.init()
      
      //]]
      </script>
      regards,
      Omer Aslam

      Comment

      Working...