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 8561869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:36:06+00:00 2026-06-11T16:36:06+00:00

Bear with me… I’m not really a developer, so I’m sure I haven’t gone

  • 0

Bear with me… I’m not really a developer, so I’m sure I haven’t gone about this in the best way to begin with, but I’m hoping we can work with what I’ve got to make it work properly…

I’ve got a combination of js and php that work together to flash pairs of images on the screen, and then capture the key presses for choosing the left or right image (using ‘c’ and ‘m’ or the left-arrow and ‘right-arrow’).

It seems to work fine on Safari, Firefox and IE, but is not working consistently in Chrome (sometimes it does, sometimes it doesn’t).

I just looked at the inspector in Chrome while running it, and found that two of the functions weren’t being found:

Uncaught ReferenceError: imgChoice is not defined
(anonymous function)

Uncaught ReferenceError: stopChoice is not defined
(anonymous function)

In my searching for an answer, the closest I got was that it might be that Chrome is processing the flashImages() function too quickly and isn’t getting to the other two.

Is there a way I could fix this? Perhaps integrate the imgChoice and stopChoice functions into the flashImages function?

Here are the existing functions:

function imgChoice(imgPair)
{
    var imgDataR = '<input type="hidden" name="'+imgPair+'[<?php echo $_POST['topicNumber']; ?>]" value="r" />';
    var imgDataL = '<input type="hidden" name="'+imgPair+'[<?php echo $_POST['topicNumber']; ?>]" value="l" />';
    var noData = '<?php $noData = 1; ?>';
    $(document).keydown(function(event) {
        if (event.keyCode == 67 || event.keyCode == 37) {
            document.getElementById(imgPair+'Data').innerHTML = imgDataL;
            $(document).unbind('keydown');
            }
        if (event.keyCode == 77 || event.keyCode == 39) {
            document.getElementById(imgPair+'Data').innerHTML = imgDataR;
            $(document).unbind('keydown');
        }
    });
    //div = document.getElementById(imgPair);
}
function stopChoice(imgPair)
{
    $(document).unbind('keydown');
}
function flashImages()
{
i=500;
//$('#startTopic').fadeOut(500);
setTimeout("document.getElementById('fullpd').style.cursor='none';",50);
setTimeout("document.getElementById('fullpd').style.background='#464646';",500);

for(x=1;x<=imgPairs.length-1;x++)
    {
    setTimeout("document.getElementById('clickSound').play();",i+2000);
    setTimeout('document.getElementById("'+imgPairs[x]+'").style.display="block";',i+3500)
    setTimeout('imgChoice("'+imgPairs[x]+'");',i+3495)
    setTimeout('document.getElementById("'+imgPairs[x]+'").style.display="none";',i+4000)
    setTimeout('stopChoice("'+imgPairs[x]+'");',i+6000)
    i=i+4000;
    }
setTimeout("document.getElementById('fullpd').style.background='#eaeaea';",i+1000)
setTimeout("document.getElementById('fullpd').style.cursor='default';",i)
setTimeout(function() {$('#endTopic').fadeIn(1000);},i+1000);
}
  • 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-11T16:36:07+00:00Added an answer on June 11, 2026 at 4:36 pm

    Why don’t you try delegating the events when you are binding the event handlers.. maybe that might help..

    $(document).keydown(function(event) { Instead of this try

    $(document).on('keydown' ,function(event) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

firstly bear with me this might not come out the way i intend it
Bear with me, this one's not very easy to explain... I'm trying to configure
Bear with me... I don't think this is too subjective but maybe I'm wrong.
Bear with me here, but assuming this code: <style> span { color: black; background-color:
(Bear with me, I promise this gets to shebang and windows.) I have about
(Bear with me here, I'll attempt to explain this as best I can. Please
Please bear with me. I really want to know as I am curious about
Please bear with me if this question isn't well formulated. Not knowing is part
Bear with me, this sounds like a random thing to want to do but
Bear with me if this is unclear; I have trouble fully wrapping my head

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.