Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2007, 10:59 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default how to link slideshow images on js

how to link slideshow images on js


I found and worked on a script which makes a slideshow out of my pictures. But I would like to add the proper links to every picture. Here's what I have:

Code:
<html>
<head>
    <title>Greg's Auctions</title>
<script language="JavaScript">
<!-- 
var interval = 1500; 
var random_display = 0;
var image_dir = ""
var ImageNum = 0;
imageArray = new Array();

imageArray[ImageNum++] = new imageItem(image_dir + "http://i.domaindlx.com/wheelofgod/transformers/constructicons.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "http://i.domaindlx.com/wheelofgod/transformers/decepticonbeasts.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "http://i.domaindlx.com/wheelofgod/transformers/decepticontargetmasters.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "http://i.domaindlx.com/wheelofgod/transformers/optimusrodimustrailers.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "http://i.domaindlx.com/wheelofgod/transformers/ultramagnus.jpg");

var number_of_image = imageArray.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
ImageNum = randNum(0, number_of_image-1);
}
else {
ImageNum = (ImageNum+1) % number_of_image;
}
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}

function getPrevImage() {
ImageNum = (ImageNum-1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);
return(new_image);
}

function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
}

function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
timerID = setTimeout(recur_call, interval);
}


//   -->
</script>
</head>
<body bgcolor="#ffffff" onLoad="rotateImage('rImage')">
<center>
<table border=0 cellpadding=4 cellspacing=0>
<tr>
    <td class="td" align=center><b>Take a look at my other auctions</b>
    <p><a href="#" onClick="rotateImage('rImage')">> play slideshow</a>&nbsp;&nbsp;<a href="#" onClick="clearTimeout(timerID)">|| pause slideshow</a><br>

    <a href="#" onClick="prevImage('rImage'); clearTimeout(timerID)"><< previous</a>&nbsp;&nbsp;<a href="#" onClick="rotateImage('rImage'); clearTimeout(timerID)">next >></a><br></td>
</tr>
<tr>
    <td class="td" align=center><img name="rImage" src="27.jpg" width=500 height=375 border=1>
    <p><a href="http://i.domaindlx.com/wheelofgod">http://i.domaindlx.com/wheelofgod</a></td>
</tr>
</table>
</center>
</body>

</html>
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm
Reply With Quote
  #2 (permalink)  
Old January 25th, 2007, 07:16 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii gilgalbiblewheel!!

Add Event Handler with the Image click and provide the link

Cheers :)

vinod
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to provide download link for images snowbydave1 PHP How-To 2 March 27th, 2007 12:11 AM
How to provide download link for images snowbydave1 Pro PHP 0 March 19th, 2007 02:06 AM
How to provide download link for images snowbydave1 PHP Databases 0 March 19th, 2007 02:04 AM
How to provide download link for images snowbydave1 PHP FAQs 0 March 19th, 2007 02:03 AM
dynamically link js file darkhalf Javascript 3 September 15th, 2006 09:05 AM



All times are GMT -4. The time now is 04:48 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.