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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:46:05+00:00 2026-06-15T22:46:05+00:00

Just made a simple text game using JavaScript. Were I ask a math question

  • 0

Just made a simple text game using JavaScript. Were I ask a math question and the user has to enter a value. There are 4 boxes on the page and what I am trying to figure out is how do I get it so when the user enters all the right answers for something like text to pop up on the page.

Below. the code has been repeated 4 times.

function changecolour1(textbox) {
    var val = textbox.value;
    if (val == 26) {
        textbox.style.backgroundColor = 'green';
    } else {
        textbox.style.backgroundColor = 'red';
    }
}

So again just trying 2 figure out when the user enters the right number in the 4 boxes how do I get it so it pops up saying well done.

  • 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-15T22:46:06+00:00Added an answer on June 15, 2026 at 10:46 pm
    var counter=0;
    function changecolour1(textbox) {
    var val = textbox.value;
    if (val == 26) {
        textbox.style.backgroundColor = 'green';
        counter++;
        if(counter==4)
        {
            alert('well done');
        }
    }
    else {
        textbox.style.backgroundColor = 'red';
        counter--;
        if(counter < 0)
        {
           counter=0;
        }
    }
    }
    
    function reset(){
        counter=0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey so i'm making a simple text game using the pdCurses library and a
I need to scrape a simple webpage which has the following text: Value=29 Time=128769
I just made a simple HTML5 game for mobile webkit. I have made a
I just made a very simple test app using documentation from MSDN. All I
I have made a very simple Pie Graph generator using Javascript & SVG graphics.
I've just made a really simple toggle button. Function checks the state (a class),
so I'm making some basic programming language (just for exercise). I've made simple grammar
I made a simple module for Lighttpd to experiment with it. If I just
I have just started on AWT and made a simple program in it, it
Just wondering about some practice about this; I have made a simple visual C#

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.