Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with a slideshow script

    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.

    Code:
    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.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by ampulator00; 08-17-2004 at 04:54 AM.

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yea well, looking at it again your solution may be here:

    document.getElementById(slideID[change])

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

    .....Willy

  • #5
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Doh, that's the link to the wrong web page! sorry, that's the page that uses the javascript!

    It's actually here.

    And here's some sample code:

    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>
    Attached Thumbnails Attached Thumbnails Help with a slideshow script-methuss.gif   Help with a slideshow script-methussma.gif  
    Last edited by ampulator00; 08-17-2004 at 05:38 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •