match pictures

Discussion in 'JavaScript' started by kadi, Aug 1, 2013.

  1. #1
    hi, anyone can help me on how to match pictures using javascript

    bird-------------> seeds
    cat-------------> milk

    so if we consider above there are four images(bird, seeds, cat, milk, for sake of convenience i am just writing names as it wil b easy to understand what i am trying to say),

    As birds feed on seeds and cat on milk. we need to match those pictures in javascript like this

    if we click on bird and then on seeds it should say "correct match" and both images needs to vanish else "not correct match and try again"

    if we click on cat and then on milk it should say "correct match" and both images needs to vanish else "not correct match and try again"

    after all are matched correctly we need to redirect to homepage...

    any help
    regards
     
    kadi, Aug 1, 2013 IP
  2. codeswish

    codeswish Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    This roughly demonstrates one of the most basic ways of achieving what you want: http://jsbin.com/ugiwok/3/edit

    Mind you, this code is not meant for production and I do sincerely hope you take the time to iron out the bugs and refactor it appropriately.
     
    codeswish, Aug 2, 2013 IP