Results 1 to 3 of 3

Thread: Switch Content Script - Validator?

  1. #1
    Join Date
    Feb 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Switch Content Script - Validator?

    1) Script Title: Switch Content Script

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

    3) Describe problem:

    Hi all, This isnt a major problem, but i am using the above script and my page wont pass the WC3 validator because of the code :

    bobexample.setStatus('<img src="../jscripts/close.gif" alt="close" /> ', '<img src="../jscripts/open.gif" alt="open" /> ')

    the validator says :

    Line 890, Column 68: document type does not allow element "img" here.

    …"../jscripts/close.gif" alt="close" /> ', '<img src="../jscripts/open.gif" al....

    anyone know a way around this? worse comes to the worse i will just leave it as is and not have the page validated as i like this script.

    thanks
    James

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

    Default

    If the status HTML will always be images, you can modify the script so you merely enter the paths to the images (instead of its entire HTML), and have the script output the image accordingly. Inside the .js file, edit the setStatus() function so it looks like this instead (changes in red):

    Code:
    switchcontent.prototype.setStatus=function(openHTML, closeHTML){ //PUBLIC: Set open/ closing HTML indicator. Optional
    	this.statusOpen='<img src="'+openHTML+'" alt="open" />'
    	this.statusClosed='<img src="'+closeHTML+'" alt="close" />'
    }
    Then, in your HTML when calling this method, do:

    Code:
    bobexample.setStatus('../jscripts/close.gif', '../jscripts/open.gif')
    DD Admin

  3. #3
    Join Date
    Feb 2005
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    fantastic...

    did the job...

    thanks very much

    james

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
  •