...

View Full Version : Javascript Image link Problem



Ramstein
10-24-2005, 03:36 PM
Hey I am having problems with this code, Its supose to open a link every time you click on a different image every different image will take you to separate different links but whats happening is that its not leting me click the images and it wont take me to the links.

Can some one pls take a look at it and let me know whats rong with it? Thanx!




<html>
<head>
<script language="JavaScript1.1">

var slideimages=new Array()
var slidelinks=new Array()

function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}

</script>

<title>Untitled</title>
</head>

<body onload="slideit();">
<script>

slideshowimages("One.gif", "Two.gif", "Three.gif")
slideshowlinks("http://mysite.com", "http://mysite.com", "http://mysite.com")


var slideshowspeed=2000
var whichlink=0
var whichimage=0

function slideit(){
if (!document.images)
return
document.images.slide.src=slideimages[whichimage].src
whichlink=whichimage

if (whichimage<slideimages.length-1)
whichimage++
else
whichimage=0
setTimeout("slideit()",slideshowspeed)
}


</script>

<img name="slide">

</body>
</html>

Mr J
10-24-2005, 07:56 PM
Try this


<html>
<head>
<script language="JavaScript1.1">

var slideimages=new Array()
var slidelinks=new Array()

function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function gotoshow(url){
if (!window.winslide||winslide.closed)
winslide=window.open(url)
else
winslide.location=url
winslide.focus()
}

</script>

<title>Untitled</title>
</head>

<body onload="slideit()">
<script>

slideshowimages("One.gif", "Two.gif", "Three.gif")
slideshowlinks("http://mysite1.com", "http://mysite2.com", "http://mysite3.com")


var slideshowspeed=2000
var whichlink=0
var whichimage=0

function slideit(){
if (!document.images)
return

document.images.slide.src=slideimages[whichimage].src
document.getElementById("lnk").href=slidelinks[whichimage]

if (whichimage<slideimages.length-1)
whichimage++
else
whichimage=0
setTimeout("slideit()",slideshowspeed)
}


</script>

<a id="lnk" href="#null" onclick="gotoshow(this.href) ; return false"><img name="slide"></a>

</body>
</html>

matazz
08-16-2007, 04:45 AM
Hello,

I came across this script and thought I could modify it to my own needs, but it's not working for me. (I do not see any images) If there are any obvious errors, I would be grateful if someone could point them out. I'm starting to think I didn't pick the best script for my needs.



<script*language="JavaScript1.1">

var*slideimages=new*Array()
var*slidelinks=new*Array()

function*slideshowimages(){
for*(i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new*Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}

function*slideshowlinks(){
for*(i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}

function*gotoshow(url){
if*(!window.winslide||winslide.closed)
winslide=window.open(url)
else
winslide.location=url
winslide.focus()
}

</script>


<body onload="slideit()" id="intro">

<script>

slideshowimages("/img/slideshow/01.jpg", "/img/slideshow/02.jpg", "/img/slideshow/03.jpg")
slideshowlinks("/furnishings/lounge_chairs/product_14/index.php", "/furnishings/lounge_chairs/product_6/index.php", "/furnishings/dining_side_chairs/product_18/index.php")


var slideshowspeed=2000
var whichlink=0
var whichimage=0

function slideit(){
if (!document.images)
return

document.images.slide.src=slideimages[whichimage].src
document.getElementById("lnk").href=slidelinks[whichimage]

if (whichimage<slideimages.length-1)
whichimage++
else
whichimage=0
setTimeout("slideit()",slideshowspeed)
}
</script>

<div id="wrapper">
<h1><span>Quasi Modo</span></h1>
<h2><span>Modern Furniture</span></h2>
<?php include ("inc/nav.php") ?>
<div id="slide">
<a id="lnk" href="#null" onclick="gotoshow(this.href) ; return false"><img name="slide" /></a></div>
<div id="content">
<p>Since 1981, <em>Quasi Modo Modern Furniture</em> has specialized in retailing modernist furniture, lighting and accessories for the home and office by some of the world's most renowned designers and manufacturers.</p>
</div>
<?php include ("inc/footerhome.php") ?></div>

</body>


Any help would be appreciated... I'm still learning how this all works!
Thanks.

Mr J
08-16-2007, 03:22 PM
In your script you have asterisks * where there should be a space?

matazz
10-01-2007, 05:15 AM
The asteriks are spaces in my file... something must have happened with the cutting and pasting.

I'm still not having any luck with the script.

Mr J
10-01-2007, 03:01 PM
I replaced the asterisks in your script with spaces and the script ran ok



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum