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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:05:56+00:00 2026-06-09T20:05:56+00:00

I am new to javascript and html and I am writing a program that

  • 0

I am new to javascript and html and I am writing a program that displays a dropdown list and depending on what option is selected, I then display two radio buttons and a textfield. I am having trouble getting access to the values of these inputs (both for the radio buttons and for the text box).

<html>
<script type="text/javascript">

    window.onload = function()
    {
        var select = document.getElementById("select");
        var texts = document.getElementById("texts");

        select.onchange = function()
        {
            var val = select.options[select.selectedIndex].value;

            texts.innerHTML = "";
            if (val == "employees")
            {
                texts.innerHTML += '<div><input type="radio" name="condition_employees"  value="select_money" /> ></div>';
                texts.innerHTML += '<div><input type="radio" name="condition_employees"  value="select_money1" /> <</div>';
                texts.innerHTML += '<div><input type="text" name="input_employees"  value="select_employees" /></div>';
                //var realValue = document.getElementByName('input_employees')[0].value;
                //texts.innerHTML += '<div>realValue</div>';


            }

            if (val == "total_money")
            {
                texts.innerHTML += '<div><input type="radio" name="condition_money"  value="select_money" /> ></div>';
                texts.innerHTML += '<div><input type="radio" name="condition_money"  value="select_money1" /> <</div>';

                texts.innerHTML += '<div><input type="text" name="input_money"' + '" value="select_money" /></div>';
            }

            if (val == "hits")
            {
                texts.innerHTML += '<div><input type="radio" name="condition_hits"  value="select_money" /> ></div>';
                texts.innerHTML += '<div><input type="radio" name="condition_hits"  value="select_money1" /> <</div>';

                texts.innerHTML += '<div><input type="text" name="input_hits"' + '" value="select_hits" /></div>';
            }

            if (val == "time_founded")
            {
                texts.innerHTML += '<div><input type="radio" name="condition_time"  value="select_money" /> before date </div>';
                texts.innerHTML += '<div><input type="radio" name="condition_time"  value="select_money1" /> after date</div>';

                texts.innerHTML += '<div><input type="text" name="input_time"' + '" value="select_date" /></div>';
            }

        }
    }
    var print = function()
    {
        var category = document.droplist.select.value;
        document.getElementById("category").innerHTML = category


    }

</script>

<body>      
    <form name="droplist" action="html_form_action.asp" method = "get">
    <select id="select" size="1">
        <option value=" " selected="selected"> </option>
        <option value="employees">Number of Employees</option>
        <option value="hits">Hits on TechCrunch</option>
        <option value="time_founded">Time Founded</option>
        <option value="total_money">Total Money</option>
        </select>

        <hr/>

        <div id="texts"></div>

        <input type="button" value="Submit" onClick="print()"/>
    </form> 
        <div id="category"></div>

</body>

I tried to do this by using “//var realValue = document.getElementByName(‘input_employees’)[0].value;” but this is clearly not working. I would also like to know how to then pass on this information as a paramater for a function in my python app.

Thanks!

  • 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-09T20:05:57+00:00Added an answer on June 9, 2026 at 8:05 pm

    Might I suggest the following:

    1. Don’t re-write the <div>s in your javascript. You can write to the <div>‘s innerHTML.
    2. Instead of constantly writing these values, why not disable/enable as necessary?

    I unfortunately cannot comment on the question, so I had to post here. Sorry about that.

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

Sidebar

Related Questions

Very new to javascript and html-type stuff. I wanted to just make a quick
I am new to HTML and Javascript. Please someone can help me with the
I'm writing some JavaScript that changes the size of some content. To do this
I'm writing a webpage that relies on an external javascript file (that I have
I'm opening new page using JS and writing into it the HTML code, however
I'm writing a program in Python that needs to use a site's advanced search
I am a bit new to Javascript. I am writing this dummy script to
I want to write a javascript function that returns HTML content as string given
I am writing a custom validation set that will display all missing elements on
Scenario: I'm creating a new window (new tab) and writing html markup to it

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.