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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:22:56+00:00 2026-06-10T00:22:56+00:00

Does anyone have any simple JavaScript functions that persistently change the state of a

  • 0

Does anyone have any simple JavaScript functions that persistently change the state of a button onclick? As in:

[button1] [button2] [button3]

Then, when you click button 1, something like this happens:

(((button1))) [button2] [button3]

Then, if you were to click button2, this would happen:

[button1] (((button2))) [button3]

Where the image associated with button 1 is changed, persistently.

I checked out this answer https://stackoverflow.com/a/4967732/73844 and this answer https://stackoverflow.com/a/7991898/738448 but am having trouble seeing how they fit together to do what I want to do. Any help would be appreciated.

Here is the code I’ve tried:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#prog
{
    margin: 5px 85px;
    width: 200px;
    height: 40px;
    background:url(prog_off.png) no-repeat;
    border: 0;
}
</style>
<script type="text/javascript">
function changeImage() {
    test=document.getElementById("prog");
    test.backgroundImage="url(prog_on.png)";
}
</script>
</head>
<body>
<input type="button" id="prog" onClick="changeImage()" />
</body>
</html>
  • 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-10T00:22:57+00:00Added an answer on June 10, 2026 at 12:22 am

    Are you looking for something like this?

    http://jqueryui.com/demos/button/radio.html

    If so, it’ll be easier (and better since its tested across all browsers etc..) using jQuery UI’s button widget instead of developing afresh.

    http://jqueryui.com/demos/button/#radio

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have code of a simple web browser file/script (HTML/javascript/whatever) that can upload
I'm looking to write a simple proxy server in .NET. Does anyone have any
Does anyone have any idea how to change the thickness of the text pointer
Does anyone have any tips that could help speed up a process of breaking
Does anyone have any examples on how to integrate a task scheduler in Bottle.
DOes anyone have any good information with regards to when to log, I was
Does anyone have any useful advice/links to information about working with mp3 files in
Does anyone have any advice or techniques for deploying SSIS packages to the Integration
Does anyone have any experience querying FlexLM? (At a minimum) I need to be
Does anyone have any advice on which method is better when caching data in

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.