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 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

Related Questions

Does anyone see why this jquery click function would not work? It is not
Does anyone see anything wrong with what I am doing here? I haven't worked
Can someone elaborate how this function works? Does it load every time from disk
Does anyone know why this code doesn't work. This means, the alert is NOT
can anyone tell me why this does not work Excel.Worksheet ws_res = (Excel.Worksheet) wb.Worksheets.Add(mis,
This works: require 'csv' file = CSV.open(filename) puts file.shift This does not: require 'csv'
This works: Entities.WorkOrderSet.Where(MyCustomMethod); This does not: Entities.WorkOrderSet.Where(o => MyCustomMethod(o)); ( [Edit] Even without new
This works printf(%s body\n,__PRETTY_FUNCTION__); But this does not (Error Expected ')' ): printf(__PRETTY_FUNCTION__ body\n);
this works .. $(select[title='First Choice'] option[text='hello']).remove(); A number of variations of this does not
This works in Firefox and Chrome, but fails in IE. It does show results

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.