?
Solved

image viewer

Posted on 2012-04-09
1
Medium Priority
?
331 Views
Last Modified: 2012-04-10
Hello,

I have the following in an HTML table:

<td align="center" valign="middle">
                            Our Services<br />
                            <br />
                            &nbsp;<img src="art/webWorld.jpg" name="slide" width="120" height="100" alt="" onclick="location.href='forms/Vison.aspx'"
                                style="cursor: pointer;" />
                            <br />
                            <br />
                            <script type="text/javascript">
<!--
                                //variable that will increment through the images
                                var step = 1
                                function slideit() {
                                    //if browser does not support the image object, exit.
                                    if (!document.images)
                                        return
                                    document.images.slide.src = eval("image" + step + ".src")
                                    if (step < 3)
                                        step++
                                    else
                                        step = 1
                                    //call function "slideit()" every 2.5 seconds
                                    setTimeout("slideit()", 2500)
                                }
                                slideit()
//-->
                            </script>
                        </td>

It works very well. I would however like an additional feature. I would like to tie the image to a differant link everytime it cycles. Each image should have it's own seperate link. Additionaly I need to set a text field below the image with a uniques description based on the image.

Thank you
0
Comment
Question by:thenrich
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 2000 total points
ID: 37825881
Try this idea, it is very flexible


<table align="center">
  <tr>
    <td align="center" valign="middle">Our Services<br />
    <a href="#" id="iLink"><img name="slide" width="120" height="100" alt
    onclick="location.href='forms/Vison.aspx'" style="cursor: pointer;" /> </a><div id="iDiv"
    width="120"></div></td>
  </tr>
</table>
<script type="text/javascript">

<!--
                              ourImages = new Array ("http://www.google.com/images/logo.gif",
                                                     "http://col.stb01.s-msn.com/i/B7/EB75D45B8948F72EE451223E95A96.gif",
                                                     "https://www.google.ca/intl/en_ALL/images/logos/images_logo_lg.gif",
                                                     "http://edibleapple.com/wp-content/uploads/2009/04/apple_rainbow_logo.jpeg")

                              ourLinks = new Array ("http://www.google.com",
                                                    "http://msn.com",
                                                     "https://www.google.ca/imghp",
                                                     "http://apple.com") 
 
                              ourText = new Array ("Go to google.com",
                                                    "This for MSN, go at your own risk",
                                                     "NSFW!!!",
                                                     "Yet another apple link") 



                                //variable that will increment through the images
                                var step = 0
                                function slideit() {
                                    //if browser does not support the image object, exit.
                                    if (!document.images)
                                        return
                                    document.images.slide.src = ourImages[step]
                                    document.getElementById("iLink").href = ourLinks[step]
                                    document.getElementById("iDiv").innerHTML = ourText[step]
                                    step =(step+1)%(ourImages.length)

                                    //call function "slideit()" every 2.5 seconds
                                    setTimeout("slideit()", 2500)
                                }
                                slideit()
//-->
                            </script>

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question