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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:43:41+00:00 2026-06-10T22:43:41+00:00

I am currently working with check boxes and displaying values based on the values

  • 0

I am currently working with check boxes and displaying values based on the values chosen. Almost everything is working in exception that i have to check boxes for method of shipping. Right now the user can select two ways and this is an issue. Is there a way to only allow one check box to be checked for method of shipping? EXAMPLE

JS

<script>
function check_value(currentElement, val, id, type) {
    var el = document.getElementById("imgBox" + id);
    if (val > 0 && val < 4) { //will trigger when [1,2,3]

        if(currentElement.checked)
        {
            el.src = "images/" + type + val + ".jpg";
            el.style.display = "";
        }
        else
        {
            el.src = "";
            el.style.display = "none";
        }

    }
}    
</script>

HTML

<h2>Choose method of shipping</h2>
<form name="shipping_list">
    <input type="checkbox" name="shipping1" onclick='check_value(this, 1, "4", "shipping")'/> USPS Ground<br />
    <input type="checkbox" name="shipping2" onclick='check_value(this, 2, "4", "shipping")'/> FedEx         
</form>

<img id="imgBox4" src="#" style="display:none">
  • 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-10T22:43:43+00:00Added an answer on June 10, 2026 at 10:43 pm

    You should use radio buttons instead:

    <form name="shipping_list">
        <input type="radio" name="shipping" id="shipping1" onclick='check_value(this, 1, "4", "shipping")'/> USPS Ground<br />
        <input type="radio" name="shipping" id="shipping2" onclick='check_value(this, 2, "4", "shipping")'/> FedEx         
    </form>
    

    The key is the name attribute, the value should be same for all the radio buttons that belong to one group.

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

Sidebar

Related Questions

I am currently working with radio buttons and check boxes to display images based
I have a working javascript file that adds and removes check boxes and drop
I am currently working on an application that requires to check whether the Opensearch
I am currently working with radio buttons and check boxes to display images with
I'm working currently on a long polling script where i've to check a database
Currently working with converting SQLException error messages into messages that are more useful for
Currently working in the deployment of an OFBiz based ERP, we've come to the
Im currently working on a game that uses multi touch to apply zoom to
Am currently working on an application that requires users to submit posts and comments
I'm currently building an order form but it seems that the method I am

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.