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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:12:32+00:00 2026-06-14T13:12:32+00:00

I have a problem. I’m trying to do a show/hide on the activationframe and

  • 0

I have a problem. I’m trying to do a show/hide on the “activationframe” and “equipmentframe” divs based on a radio button selection. I had it working fine but then the client decided to add styled radio buttons to the equation. That has broken my show/hide toggle. How do I incorporate that into the styled radio button JS?

Here is the styled radio buttons script:

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "190";

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
init: function() {
    var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
    for(a = 0; a < inputs.length; a++) {
        if((inputs[a].type == "radio") && inputs[a].className == "styled") {
            span[a] = document.createElement("span");
            span[a].className = inputs[a].type;

            if(inputs[a].checked == true) {
                    position = "0 -" + (radioHeight*2) + "px";
                    span[a].style.backgroundPosition = position;
                }
            inputs[a].parentNode.insertBefore(span[a], inputs[a]);
            inputs[a].onchange = Custom.clear;
            if(!inputs[a].getAttribute("disabled")) {
                span[a].onmousedown = Custom.pushed;
                span[a].onmouseup = Custom.check;
            } else {
                span[a].className = span[a].className += " disabled";
            }
        }
    }
    inputs = document.getElementsByTagName("select");
    for(a = 0; a < inputs.length; a++) {
        if(inputs[a].className == "styled") {
            option = inputs[a].getElementsByTagName("option");
            active = option[0].childNodes[0].nodeValue;
            textnode = document.createTextNode(active);
            for(b = 0; b < option.length; b++) {
                if(option[b].selected == true) {
                    textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
                }
            }
            span[a] = document.createElement("span");
            span[a].className = "select";
            span[a].id = "select" + inputs[a].name;
            span[a].appendChild(textnode);
            inputs[a].parentNode.insertBefore(span[a], inputs[a]);
            if(!inputs[a].getAttribute("disabled")) {
                inputs[a].onchange = Custom.choose;
            } else {
                inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
            }
        }
    }
    document.onmouseup = Custom.clear;
},
pushed: function() {
    element = this.nextSibling;
    if(element.checked == true && element.type == "radio") {
        this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
    } else {
        this.style.backgroundPosition = "0 -" + radioHeight + "px";
    }
},
check: function() {
    element = this.nextSibling;
            this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
            group = this.nextSibling.name;
            inputs = document.getElementsByTagName("input");
            for(a = 0; a < inputs.length; a++) {
                if(inputs[a].name == group && inputs[a] != this.nextSibling) {
                    inputs[a].previousSibling.style.backgroundPosition = "0 0";
        }
        element.checked = true;
    }
},
clear: function() {
    inputs = document.getElementsByTagName("input");
    for(var b = 0; b < inputs.length; b++) {
        if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
        } else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
            inputs[b].previousSibling.style.backgroundPosition = "0 0";
        }
    }
},
choose: function() {
    option = this.getElementsByTagName("option");
    for(d = 0; d < option.length; d++) {
        if(option[d].selected == true) {
            document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
        }
    }
}
}
window.onload = Custom.init;

Here is my old script that does the show/hide:

function showhideInstall(installtype) {
if (installtype == "equipmentswap") {
    document.getElementById("activationframe").style.display = 'none';
    document.getElementById("equipmentframe").style.display = 'block';
} else {
    document.getElementById("activationframe").style.display = 'block';
    document.getElementById("equipmentframe").style.display = 'none';
}
}

And finally, my HTML:

<div id="activationtoggle">
            <form class="radiobuttons">
                <input type="radio" name="installtype" value="activation" class="styled" onclick="showhideInstall(this.value);" checked>&nbsp;&nbsp;New Activation
                <input type="radio" name="installtype" value="equipmentswap" class="styled" onclick="showhideInstall(this.value);" >&nbsp;&nbsp;Equipment Swap
            </form>
        </div>

        <div id="activationframe">
            <div id="activationchecklist">
                    code here
                 </div>

             <div id="equipmentframe">
                <div id="equipmentswap">
                <h2>Equipment Swap</h2>
               more code here
                 </div>

Any help would be GREATLY appreciated. I’m middling at JS (at best) and this has proven to be a giant time sink.

  • 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-14T13:12:33+00:00Added an answer on June 14, 2026 at 1:12 pm

    Had a friend help me resolve the problem, thanks for the help, everyone.

    Here is the JS he supplied me with:

        function showhideInstall(installtype) {
        if (installtype == "equipmentswap") {
            document.getElementById("activationframe").style.display = 'none';
            document.getElementById("equipmentframe").style.display = 'block';
        } else {
            document.getElementById("activationframe").style.display = 'block';
            document.getElementById("equipmentframe").style.display = 'none';
        }
    }
    function newactivation( indexNum ) {
    
        var inputs = document.getElementsByTagName("label");
        for(a = 0; a < inputs.length; a++) {
    
            if( inputs[a].id == "activation" + indexNum ){
                inputs[a].style.color = "#b5b5b5";  
            }
        }
    
        var activechecked = 0;
      for (var i = 1; i<= 7; i++) {
            if(document.getElementById("activationcheck" + i).checked == true){
                activechecked ++;
            }else if(document.getElementById("activationnocheck" + i).checked == true){
                activechecked ++;
            }
      }
    
      if (activechecked <= 6) {document.getElementById("next").disabled= true;}
      if (activechecked == 7) {document.getElementById("next").disabled= false; document.getElementById("next").style.cursor= "pointer"; } 
    }
    function equipmentswap( indexNum ) {
        var inputs = document.getElementsByTagName("label");
        for(a = 0; a < inputs.length; a++) {
    
            if( inputs[a].id == "equip" + indexNum ){
                inputs[a].style.color = "#b5b5b5";
                a=inputs.length + 1;        
            }
        }
    
        var activechecked = 0;
      for (var i = 1; i<= 7; i++) {
            if(document.getElementById("swapcheck" + i).checked == true){
                activechecked ++;
            }else if(document.getElementById("swapnocheck" + i).checked == true){
                activechecked ++;
            }
      }
    
      if (activechecked <= 6) {document.getElementById("equipnext").disabled= true;}
      if (activechecked == 7) {document.getElementById("equipnext").disabled= false; document.getElementById("next").style.cursor= "pointer"; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with show or hide form in Window Form Application. I start
i have problem with build my own webservice based on cxf/camel. My webservice should
I have problem witch change style border-left-color in next button, if main button is
I have problem in my PHP code. I'm trying to make internet shop and
I have problem with configuring NODE.JS. I was trying to install node.js with this
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with repopulating form_upload after validation. Other input fields or selectboxes are
I have problem with UIWebView delay when the load image from url. In my
I have problem while loading data into html select when users press or click

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.