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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:31:06+00:00 2026-06-16T00:31:06+00:00

I have a form that requires three inputs as follows: <form> <input name=mn type=number

  • 0

I have a form that requires three inputs as follows:

  <form>
    <input name="mn" 
           type="number"
           min="1"
           value="1">
    <input name="mx" 
           type="number"
           min="2"
           value="10">
    <input name="step" 
           type="number"
           min="1"
           value="1">
    <input onclick="myfunc()"
           type="submit"
           value="calculate">
  </form>

all i require is to be able to access the three fields directly in javascript. I do not need to pass the information anywhere else.

Could anyone point me in the right direction? I have read examples where there has been one input, but not multiple.

  <script type="text/javascript">
    function myfunc() {
    var mn = document.getElementsByName("mn")
    var mx = document.getElementsByName("mx")
    var step = document.getElementsByName("step")
    alert((mn + mx) / step)
    }
  </script>
  • 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-16T00:31:07+00:00Added an answer on June 16, 2026 at 12:31 am

    Give your form an id like so

    <form id="myForm">
    

    The other thing to watch out for is that the is that the value attribute is a string so adding the two values concatenates them rather than summing them.

    Try instead

    var frm = document.forms["myForm"];
    
    var _mn = parseInt( frm["mn"].value );
    var _mx = parseInt( frm["mx"].value );
    var _step = parseInt( frm["step"].value );
    
    var result = ( _mn + _mx ) / _step;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that sends money value e.g <input type=text name=amount value=N50,000.00 NGN
I have three inputs coming in from a form. They are name , neighborhoods
I have a form that includes the first name and last name of a
I'm writing a program that requires input in the form of a document, it
So I have a form that has 4 inputs, 2 text, 2 hidden. I've
I have a form that has a required input, but jQuery is saying that
I have a form that uses inputs to create and array. The inputs are
I have an admin form that lets users create entities that require an image.
I currently have form that checks if a user has unsubmitted changes when they
I have a form that I'm submitting through AJAX. The form includes many fields,

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.