View Single Post
Old 02-14-2013, 03:21 AM   PM User | #1
Tom Sparks
New Coder

 
Join Date: Feb 2013
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Tom Sparks is an unknown quantity at this point
Rotate Text with Pictures

I'm trying to figure out how to cycle a set of pictures with the corresponding descriptions in a table, here is my picture code:
Code:
<script type="text/javascript">
	var imgArray = new Array(6);
	imgArray[0] = new Image;
	imgArray[0].src = "../Images/LondonBus.jpg";
	imgArray[1] = new Image;
	imgArray[1].src = "../Images/eiffeltower.jpg";
	imgArray[2] = new Image;
	imgArray[2].src = "../Images/polishmines.jpg";
	imgArray[3] = new Image;
	imgArray[3].src = "../Images/vailskiing.jpg";
	imgArray[4] = new Image;
	imgArray[4].src = "../Images/steamboatskiing.jpg";
	imgArray[5] = new Image;
	imgArray[5].src = "../Images/polishmines.jpg";

	var index =0;


	function cycle()
	{
   
	document.pic.src = imgArray[index].src;
		index++;
		if (index==6)
		{
			index = 0;
		}
		setTimeout("cycle()", 3000);
		return;
	}
</script>
But the main problem I have is converting similar code into rotating text,
Code:
<SCRIPT type = "text/javascript">
quotation = new Array();
quotation[0] = "London"
quotation[1] = "Paris"
quotation[2] = "Poland"
quotation[3] = "Vail"
quotation[4] = "Steamboat"
quotation[5] = "Poland"

function cycle()
	{
	document.text.src = imgArray[index].src;
		index++;
		if (index==6)
		{
			index = 0;
		}
		setTimeout("cycle()", 3000);
		return;
	}
window.onload=changetext();
</script>
I know that the document.text.src is wrong for text references so how could I link that to a div id or table box?
Thank you!

Last edited by Tom Sparks; 02-14-2013 at 03:21 AM.. Reason: ....may have forgotten to close the code tags...
Tom Sparks is offline   Reply With Quote