Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
Thread: Matching different images
07-22-2013, 08:17 PM #1
- Join Date
- Jul 2013
- Thanked 0 Times in 0 Posts
Matching different images
hi, i am trying to match images. this one works fine only with same images but i want to match unidentical images based on their id or src
below is the working code for similar images
can u help me the code with different images based on the image id or src. i am trying to do but i cant get it. plz help me with...
07-22-2013, 10:12 PM #2
Is this supposed to be a "matching" game? Where the player reveals two images and, if they match, then they win?
If so, I wouldn't even begin to code it like that. I'd put just the 3 image URLs into an array and then use code to create an array of double that size with each URL in there twice, shuffle the array, and then "deal" the cards face down. That code, where you have to put each image in place on the screen twice ahead of time is clumsy. Plus, if you wanted to change the number of images to 4 or 5 or 10 you'd have to almost rewrite the page.Be yourself. No one else is as qualified.
07-22-2013, 10:14 PM #3
And when you say "unidentical", how could you then expect to match on .src when that value will be different for each image?? Matching on ID is possible, except that IDs are supposed to be UNIQUE on a page. So matching on name would be better (names don't have to be unique).Be yourself. No one else is as qualified.
07-23-2013, 09:34 PM #4
- Join Date
- Sep 2005
- Sydney, Australia
- Thanked 932 Times in 919 Posts
See http://www.felgall.com/jstip173.htm for a matching game that allows for one or two sets of images. Where a second set of images is provided the images match those in the same position in the extra array.