...

View Full Version : Help with a slideshow script



ampulator00
08-17-2004, 04:07 AM
What this script does, is when this function is called, it switches to another image. Now, what I need is the "alt" attribute of the images to do the same thing. Thanks for you time.




var thisPic = [0, 0, 0, 0, 0];
function chgSlide(change, direction)
{
thisPic[change] += direction;
imgCt = slideChoice[change].length -1;
if(document.images)
{

if(thisPic[change] > imgCt)
thisPic[change] = 0;
if(thisPic[change] < 0)
thisPic[change] = imgCt;
document.getElementById(slideID[change]).src = slideChoice[change][thisPic[change]];
}
}


My website is here (http://ampulator.freeprohost.com/srwr.html).

Willy Duitt
08-17-2004, 04:16 AM
When providing example code it is always helpful to provide enough for a working example... In this case that would be the script, an image and the function call...

However, if I had to guess: thisPic[change].alt = 'My new alt'
Or: thisPic[change].setAttribute('alt','My new alt');

Good luck;
....Willy

ampulator00
08-17-2004, 04:46 AM
Thanks for the info. I'm going to try this asap.

I did, provide an example, that used the function. But There was a lot of extra code that might not have been related to the function. :p

Willy Duitt
08-17-2004, 04:55 AM
Yea well, looking at it again your solution may be here:

document.getElementById(slideID[change])

But, as I previsously stated.... example code.....

.....Willy

ampulator00
08-17-2004, 05:36 AM
Doh, that's the link to the wrong web page! sorry, that's the page that uses the javascript!

It's actually here. (http://ampulator.freeprohost.com/zgundam.html)

And here's some sample code:



<script type="text/javascript" charset="ISO-8859-1">
<!--
// <![CDATA[ Use this code blcok for scripts put in the <head> section

var mechMethuss = ["methuss.gif", "methussma.gif"], mechZetagundam = ["zgundam.gif", "waverider.gif"], slideChoice = [mechMethuss, mechZetagundam], slideID = ["methuss", "zetagundam"];

// ]] -->
</script>

<p><img src="methuss.gif" alt="Methuss/Methuss Mobile Armor" id="methuss" />
<br />
<input type= "button" value= "Previous" onclick= "chgSlide(0, -1)" /><input type= "button" value= "Next" onclick= "chgSlide(0, 1)" />
</p>
<p><span class="bold">Methuss: </span>The Methuss was created under "Project Zeta" to test to the feasiblity of transformation systems. Its transformation systems gave it extra speed and agility in Mobile Armor form, and allowed earth atmospheric entry. The Methuss was considered successful, and its transformation systems was later put into Zeta Gundam. However, due to its original purpose, it was not designed for combat. However, it was easy to repair. It is regulated as an repair unit.</p>
<p><span class="bold">First Pilot: </span>Fa Yuiri</p>
<div class="border1"></div>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum