Results 1 to 4 of 4

Thread: Thumbnail Viewer II validation problem

  1. #1
    Join Date
    May 2005
    Location
    UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thumbnail Viewer II validation problem - SOLVED

    Hi

    I'm using the Thumbnail Viewer II with additional captions added as per the script available on this forum here: http://home.comcast.net/~jscheuer1/s...les/thumb2.htm

    I've got it all validating to XHTML 1.0 strict except the name attribue part of the script in the thumbnail section which I can't get to validate as it says that name can only be a single word.

    HTML Code:
    <a href="#" name="My Dog" onmouseover="modifyimage('dynloadarea', 0); get_cap(this.name);"><img src="images/dog.jpg" width="80" height="80" alt="My dog" /></a>
    Is there any way round this?

    Thanks

    Edit: I've tried changing the name attribute to id which works but again doesn't validate for the same reason. I've also tried adding a nonbreaking space character instead of an actual space but the validator doesn't like that either. In fact I've tried reducing the DOCTYPE and it won't have any of it! the only thing that works is an underscore but that is really ugly


    2nd Edit: OK I solved the problem eventually! I swapped a title attribute for the name attribute and that works and validates!
    Last edited by Tailslide; 07-30-2005 at 03:43 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You could also do the same thing using the alt attribute, which would give you additional flexibility in some browsers. Also, you might be able to make up an attribute say, caption and if "this.caption" won't pass the data to the function, then "this.getAttribute('caption', 0)" should. The validator shouldn't mind what you set the caption attribute to but, it might object to it as an invalid attribute. All in all, worrying about these things validating when you are not using them for their designed purpose, is a bit of overkill. If, on the other hand, you needed to also use the name attribute for one of its intended uses, then you might need to worry. Generally, validators are more strict than browsers, even with a given doctype.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2005
    Location
    UK
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that.

    I did actually try swapping the name attribute for caption but again the validator spat it back at me. In the end I would have stuck with the original name attribute and taken the hit at the validator - I just like to try to pass it if I can without pulling all my hair out!

    Thanks again.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    More about the flexibility afforded by using the alt attribute. Using the title attribute, as you probably discovered, also has the effect of a tool tip onmouseover of the thumbnail image. By using the alt attribute and specifying a title like so:
    Code:
    title=""
    you get no tool tip. Or, you could specify a title different than the caption (now held in the alt attribute), and thereby achieve a tool tip different than the caption. All acceptable to the validator. However, the alt attribute will still be used for its intended purpose as well, text to be displayed if the image cannot be rendered.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •