I
Iain
Hi All
My apologies if this appears to be simple to some of you but I have
very little experience of javascript and I cannot work this one out,
The code below is a nice piece of code I found on the web to rotate a
set of images. It works very well.
However, I would like to place a value in the HREF which points to a
larger version of the image currently being displayed
Example
The image being displayed may be a thumbnail tn_image1.jpg
I would like the HREF point to the image image1.jpg (the images will
always be the same name as the thumbnails but without the tn_ prefix).
Any help would be gratefully received
Iain
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%@LANGUAGE="VBSCRIPT"%>
<%
DIM objFSO, objFile, objFileTextStream, ImageCount
Set objFSO = CreateObject("Scripting.FileSystemObject")
LPP=server.MapPath("teegan.txt")
Set objFile = objFSO.GetFile(LPP)
Set objFileTextStream = objFile.OpenAsTextStream(1)
%>
<html>
<head>
<script language="JavaScript">
<!-- // Hide from old browsers --
/* This is a transition banner rotating script uses IE filters.
Netscape does a simple image swap */
var step=1
var speed=2 /* change speed below (in seconds) this value
determines how long each banner remains before it is changed */
/* =========================== IMAGES ========================= */
/* Begin Edit Here
*/
/* Source found at
http://www.havenofbliss.com/javascript/banner.html */
/* Add images as needed, but remember to update the number of
images variable */
/* ============================================================ */
<%
ImageCount=1
Do while objFileTextStream.AtEndOfStream <> True
StrLine=objFileTextStream.ReadLine
if StrLine<>"" then
%>
var image<%=ImageCount%>=new Image()
image<%=ImageCount%>.src='<%=trim(StrLine)%>'
<%
ImageCount=ImageCount+1
end if
loop
objFileTextStream.Close
%>
var number_of_images = <%=ImageCount-1%>
var name_of_image = <%=trim(StrLine)%>
window.onerror=reapply
function reapply()
{
/* Incase of an error, restart banner rotation */
setTimeout("slideit()",2000);
return true;
}
function slideit()
{
if (!document.images)
return;
if (document.all)
slide.filters.blendTrans.apply();
document.images.slide.src=eval("image" + step + ".src");
if (document.all)
slide.filters.blendTrans.play();
if (step < number_of_images)
step++;
else
step=1;
if (document.all)
setTimeout("slideit()", speed * 1000 + 3000);
else
setTimeout("slideit()", speed * 1000);
}
</script>
<title>Rotating Images</title>
</head>
<body onLoad="slideit();">
<!-- The following image tag is the place holder for the banner
-->
<br><br><br><br><br>
<center>
<A HREF = HOW DO I DERIVE THIS>
<IMG name = slide src = "background001.jpg" style =
"FILTER: blendTrans(duration = 3)"><br>IMAGE NAME</A>
</center>
</body>
</html>
My apologies if this appears to be simple to some of you but I have
very little experience of javascript and I cannot work this one out,
The code below is a nice piece of code I found on the web to rotate a
set of images. It works very well.
However, I would like to place a value in the HREF which points to a
larger version of the image currently being displayed
Example
The image being displayed may be a thumbnail tn_image1.jpg
I would like the HREF point to the image image1.jpg (the images will
always be the same name as the thumbnails but without the tn_ prefix).
Any help would be gratefully received
Iain
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<%@LANGUAGE="VBSCRIPT"%>
<%
DIM objFSO, objFile, objFileTextStream, ImageCount
Set objFSO = CreateObject("Scripting.FileSystemObject")
LPP=server.MapPath("teegan.txt")
Set objFile = objFSO.GetFile(LPP)
Set objFileTextStream = objFile.OpenAsTextStream(1)
%>
<html>
<head>
<script language="JavaScript">
<!-- // Hide from old browsers --
/* This is a transition banner rotating script uses IE filters.
Netscape does a simple image swap */
var step=1
var speed=2 /* change speed below (in seconds) this value
determines how long each banner remains before it is changed */
/* =========================== IMAGES ========================= */
/* Begin Edit Here
*/
/* Source found at
http://www.havenofbliss.com/javascript/banner.html */
/* Add images as needed, but remember to update the number of
images variable */
/* ============================================================ */
<%
ImageCount=1
Do while objFileTextStream.AtEndOfStream <> True
StrLine=objFileTextStream.ReadLine
if StrLine<>"" then
%>
var image<%=ImageCount%>=new Image()
image<%=ImageCount%>.src='<%=trim(StrLine)%>'
<%
ImageCount=ImageCount+1
end if
loop
objFileTextStream.Close
%>
var number_of_images = <%=ImageCount-1%>
var name_of_image = <%=trim(StrLine)%>
window.onerror=reapply
function reapply()
{
/* Incase of an error, restart banner rotation */
setTimeout("slideit()",2000);
return true;
}
function slideit()
{
if (!document.images)
return;
if (document.all)
slide.filters.blendTrans.apply();
document.images.slide.src=eval("image" + step + ".src");
if (document.all)
slide.filters.blendTrans.play();
if (step < number_of_images)
step++;
else
step=1;
if (document.all)
setTimeout("slideit()", speed * 1000 + 3000);
else
setTimeout("slideit()", speed * 1000);
}
</script>
<title>Rotating Images</title>
</head>
<body onLoad="slideit();">
<!-- The following image tag is the place holder for the banner
-->
<br><br><br><br><br>
<center>
<A HREF = HOW DO I DERIVE THIS>
<IMG name = slide src = "background001.jpg" style =
"FILTER: blendTrans(duration = 3)"><br>IMAGE NAME</A>
</center>
</body>
</html>