Results 1 to 4 of 4

Thread: Swiss Army Image Slideshow: alt attribute

  1. #1
    Join Date
    Apr 2007
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Swiss Army Image Slideshow: alt attribute

    1) Script Title: Swiss Army Image Slideshow

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

    3) Describe problem: Hi again. I've decided that I want to have alt text for the images in my slideshow, so I added the "use_alt=1" property, but I'm not seeing any alt text when I mouse over the images. It occurred to me that maybe this was because I also had it set to show no descriptions, so I took that property out. But then it shows the description and still no alt text.

    So, what did I do wrong, and is it possible to have no descriptions display on the web, but still use the descriptions as alt text? Here's my slideshow:


    var slides=[];
    slides[0] = ["image1.jpg", "Garden of the Gods"];
    slides[1] = ["image2.jpg", "Garden of the Gods"];
    slides[2] = ["image3.jpg", "Garden of the Gods"];
    slides[3] = ["image4.jpg", "Garden of the Gods"];
    slides[4] = ["image5.jpg", "Garden of the Gods"];
    slides[5] = ["image6.jpg", "Garden of the Gods"];
    slides[6] = ["image7.jpg", "Garden of the Gods"];
    slides[7] = ["8.jpg", "Garden of the Gods"];
    slides[8] = ["9.jpg", "Garden of the Gods"];
    slides[9] = ["10.jpg", "Garden of the Gods"];
    slides[10] = ["11.jpg", "Garden of the Gods"];
    slides[11] = ["12.jpg", "Garden of the Gods"];
    slides[12] = ["13.jpg", "Garden of the Gods"];
    slides[13] = ["14.jpg", "Garden of the Gods"];
    slides[14] = ["15.jpg", "Garden of the Gods"];
    slides.delay=2000;
    slides.border=1;
    slides.border_color='darkblue';
    slides.no_descriptions=1;
    use_alt=1;

    I mainly want the alt text for search engine purposes, so if the user can't see them but search engines can, that's fine, too.

    Thanks!

  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

    The alt attribute doesn't do anything onmouseover. That's because well, it doesn't, never has except in IE. I had to choose how to set this up when I wrote it and chose to follow the way all other browsers do it. Fortunately IE can also do it that way. That is via the title attribute. So, what you want is really:

    slides.use_title=1

    not:

    slides.use_alt=1

    although you can use both. What the alt attribute is supposed to do and does well is provide text content if the image is missing for any reason.

    As far as I know you can use either or both of these with:

    slides.no_descriptions=1

    but, you must configure the descriptions in the array or else there will be no text to use for title or alt.

    Don't forget to use:

    slides.
    - John
    ________________________

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

  3. #3
    Join Date
    Apr 2007
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Great! That worked.

    Thanks again for all your help!

  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

    I missed an important point in your posts about this:

    I mainly want the alt text for search engine purposes, so if the user can't see them but search engines can, that's fine, too.
    There are several approaches one can take here but having the script use alt or title isn't one of them as, search engines rarely see what scripts do because it is written to the page dynamically, not hard coded.

    I think the best thing to do would be to make up a division in the body and fill it with the descriptions:

    HTML Code:
    <div id="the_descriptions">
    If you had javascript enabled you would be seeing a slide show of:<br>
    Description one<br>
    Description two<br>
    etc., etc.
    </div>
    And, in the head of the page have:

    Code:
    <script type="text/javascript">
    document.write('<style type="text\/css">\n\
    #the_descriptions {\n\
    display:none;\n\
    }\n\
    <\/style>')
    </script>
    That way they will be hard coded to the page and visible when javascript is disabled. Just the sort of thing that a search engine wouldn't ignore. It also would be a way of telling the non-javascript enabled folks what they are missing.
    - 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
  •