View Single Post
Old 01-01-2013, 02:01 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
it sounds to me like you need to set your data into objects (which is kind of js's version of a table). You can then access the object's properties using dot or square bracket notation.

If you are cycling through your images (like in a slideshow) it may be worth putting your objects into an array to make it easier to refer to them numerically.

Here's the basic setup, anyway:

Code:
<script>
var dog={title:"Fido", 
		filename:"Fido.jpg", 
		item:"3706", 
		caption: "woof!", 
		avail: "available"
		}
alert(dog.filename);
alert(dog["item"]);		
 </script>

Last edited by xelawho; 01-01-2013 at 02:04 PM.. Reason: because I cannot spell
xelawho is offline   Reply With Quote