Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:20:45+00:00 2026-06-01T17:20:45+00:00

I have set up my imagemap with the jquery-plugin mapster the code shows me,

  • 0

I have set up my imagemap with the jquery-plugin mapster

the code shows me, which countries are clicked (‘1’ for Egypt, ‘2’ for Libyia ..)

    $(document).ready(function() {

    function geklickt (e){
    //alert(typeof e.key);     return string
    $('.showme').append(e.key+ ' ');
    }


    $('img').mapster({
    mapKey: 'ALT',
    stroke: true,
    strokeWidth: 2,
    strokeColor: 'ff0000' ,
    onConfigured: function(){
    //    howto set up loop for asking user here???
    } ,
    onClick: geklickt
    });
    });

My problem:
I want to ask the user in a loop for different countries like this:
” Click on Egypt”

    if (e.key == '1')
    {
    // message "Ok"
    // add one point
    }
    else
    {
    // message "NOT Ok"
    }

“Click on Tunisia” …

I dont know how to code this loop , so that the user is asked for the first country and then the program waits until the user has clicked a country
and then the user is asked the second country ….

thanks

Kurt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:20:46+00:00Added an answer on June 1, 2026 at 5:20 pm

    You don’t need a loop. JavaScript lends itself to event-driven actions, not “waiting on user input.”

    Keep an array (or object) of the country names using their pre-defined keys and use a structure like this to prompt the user:

    <div>Click on <span id="countryname"></span></div>
    

    Then use javascript to dynamically change the name displayed based on the current key.

    Example JS (not complete, but has necessary information):

    var countryArray, currentKey;
    countryArray = [];
    /*
     * populate countryArray using keys like this
     * countryArray[key] = "Name";
     */
    function setCountry(key){
        $("#countryname").text(countryArray[key]);
    }
    
    currentKey = 0; //can be set randomly or however you'd like
    setCountry(currentKey);
    
    function geklickt (e){
        if(currentKey == e.key){
            //success
            //add one point
            currentKey = newKey; //however you want to set it
            setCountry(currentKey);
        } else {
            //failure
            //message: "NOT OK"
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up 2 servers which are linked. From my LOCAL SERVER, I
I'm using a plugin called jQuery image map emulator which takes parameters like so:
I have set default property page so in the property url it shows /lima-investments/property-name.
I have set up a macro for Smarty in Komodo Edit which adds a
I have set of classes which inherit from a single super class: Super |
I have set of categories (the number of which changes according to specific state)
I have set up an NSTimer which after one second should perform a instance
I have set up some code to pull up MFMailComposeViewController so that users of
I have set of records which I need to search using criteria. But criteria
I have set of plugins which were created in Java 1.6 before, now I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.