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

  • Home
  • SEARCH
  • 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 770989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:35:07+00:00 2026-05-14T18:35:07+00:00

This works, does anyone see anything I shouldn’t be doing? My function that is

  • 0

This works, does anyone see anything I shouldn’t be doing?

My function that is called

function getWeight(){
        var weight;
        var quantity = document.dhform.quantity.value;
        var cardSize = document.dhform.cardSize.value;
            weight = quantity * cardSize; 
        document.rates.weight.value = weight;
    }

takes values from these drop down menues

<td><span class="style29">Quantity</span><span class="style1"><br/>
                                <select id="Quantity" name="quantity" size="1">
                                    <option value="250">250</option>
                                    <option value="500">500</option>
                                    <option value="1000" selected>1000</option>
                                    <option value="1500">1500</option>
                                    <option value="2000">2000</option>
                                    <option value="2500">2500</option>
                                    <option value="3000">3000</option>
                                    <option value="4000">4000</option>
                                    <option value="5000">5000</option>
                                </select>
                            </span></td>
<td><p><span class="style1"><span class="style29">Size</span><br/>
                                      <select id="Size" name="Size" size="1" onChange="getWeight()">
                                        <option value="0.00999" selected>8.5 x 3.5</option>
                                        <option value="0.0146">11 x 4</option>
                                      </select>
                            </span></p></td>

Value needs to be inserted into this text box

<td style="width: 115px; height: 49px;"><span class="style16">Weight</span><br/>
                                  <input type="text" id="weight" name="weight" size="10" maxlength="4"/>
                              </td>
  • 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-05-14T18:35:07+00:00Added an answer on May 14, 2026 at 6:35 pm

    Yes, it’s done with Javascript. Let’s say the “choose something” part is a drop-down (an HTML select box). You add an “onchange” event handler to that select box which fires a javascript function (which will automatically get the changed select box element as a parameter). Within that function, you use the value of the select box to determine what you want the value of the other box to be, and you update that other box’s value.

    Example:

    <head>
    <script language="JavaScript">
        function setToy(dropDown) {
            var pet = dropDown.options[dropDown.selectedIndex].value);
            var newBox = document.getElementById("toy");
            var toyText = "";
            switch(pet) {
               case "dog": toyText = "bone";
               case "cat": toyText = "mouse";
               default:toyText = "";
            }
            newBox.innerHTML = toyText;
        } 
    </script></head>
    <body>
    <select name="petDropDown" onChange="updateToy(this)">
        <option value="dog">Dog</option>
        <option value="cat">Cat</option>
    </select><br />
    Preferred Toy: <input id="toy" />
    </body>
    

    I’ll add that if you do this stuff a lot, you should look into jQuery, which makes this kind of thing much easier.

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First of all, it's a really bad idea to use… May 16, 2026 at 9:17 am
  • Editorial Team
    Editorial Team added an answer If you are not dead set on using a listbox,… May 16, 2026 at 9:17 am
  • Editorial Team
    Editorial Team added an answer killproc will terminate programs in the process list which match… May 16, 2026 at 9:17 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to do something that should be really simple. I want to
In our application, I have seen code written like this: User.java (User entity) public
Thanks to everyone in advance. I've been doing some research on error handling and
I'm using a custom framework that uses reflection to do a GetTypeByName(string fullName) on
Our (asp.net) system is part of a larger system. It is launched via this
I'm trying to add a log monitor to an in-house test utility for a
I am trying to have my main thread spawn off a new thread and,
I absolutely love the Keep Remote Directory Up-to-date feature in Winscp . Unfortunately, I
I have a website which draws white (empty) content/text on IE 7. However, as

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.