SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2003
    Location
    uk
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to add url links to images in javascript

    I have a code that rotate different images and it works fine. The only thing i need to add to it is url link to images so that a user can click on an image. can anyone demonstrate how to modify the code so i can add url to it.

    Many thanks in advance


    <html>

    <head>

    <style>

    body{
    background-repeat: no-repeat;
    background-position: 200 100;}

    </style>

    <script language="JavaScript">
    <!--

    // (C) 2006 CodeLifter.com

    var speed = 3000;
    var crossFadeDuration = 10;
    var Pic = new Array();

    Pic[0] = 'leftpanel.jpg';
    Pic[1] = 'beachhol.jpg';
    Pic[2] = 'leftpanel.jpg';
    Pic[3] = 'umbrella.gif';
    Pic[4] = 'woman.gif';

    var t;
    var j = 0;
    var p = Pic.length;

    var preLoad = new Array();
    for (i = 0; i < p; i++){
    preLoad[i] = new Image();
    preLoad[i].src = Pic[i];}

    function runSlideShow(){

    if (document.all){
    document.body.style.filter="blendTrans(duration=crossFadeDuration)";
    document.body.filters.blendTrans.Apply();
    document.body.filters.blendTrans.Play();}

    if (document.body){
    document.body.background = Pic[j];
    j = j + 1
    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', speed)}

    }

    //-->
    </script>

    <title>
    CodeLifter.com :: Background Image Slideshow With Crossfade
    </title>

    </head>

    <body onload="runSlideShow()" bgcolor="white">



    </body>

    </html>

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,260
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    link

    I'm confused. You want the background image to be a link? AFAIK this won't work.

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2003
    Location
    uk
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    I want each image to have a url link. so that everytime a new image is displayed the user can click on it.


    thanks


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
  •