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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:57:52+00:00 2026-05-25T11:57:52+00:00

I need a javascript solution for the following situation: I have two select drop

  • 0

I need a javascript solution for the following situation:

I have two select drop down menus. The combination of the two of them will redirect to either of three websites after clicking the submit button:

www.exampledomainI
www.exampledomainII
www.exampledomainIII

If “A” selected it always should go straight to http://www.exampledomainI. No selection of id=”number” necessary (select menu id=”number” should disappear when selected and vice versa reappear when selection is anything else then “A” in id=”letter”)

IF the combination (eg A4 or C1 etc) is part of an array within the JavaScript than it should go to http://www.exampledomainII.

If it is part of a second array than it should go to http://www.exampledomainIII.

<select id="letter">
  <option>A</option>
  <option>B</option>
  <option>C</option>
</select>

<select id="number">
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option> 
  <option>5</option> 
  <option>6</option> 
</select>  

<input type="submit">

Thanks a lot

  • 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-25T11:57:52+00:00Added an answer on May 25, 2026 at 11:57 am

    Put the elements in a form, give the options a value attribute, attach an onsubmit listener to the form. If javascript is enabled, do the logic and set window.location.href appropriately. If javascript is disabled, not available or fails, have the server do the logic. e.g.

    <form action="..." onsubmit="return doRedirect(this);">
      <select id="letter">
        <option value="A">A
        <option value="B">B
        <option value="C">C
      </select>
    
      <select id="number">
        <option value="1">1
        <option value="2">2
        <option value="3">3
      </select>  
    
      <input type="submit">
    </form>
    
    <script type="text/javascript">
    function doRedirect(form) {
      var letter = form.letter.value;
      var number = form.number.value;
    
      if ( /* some tests using letter and number */) {
        window.location.href = 'http://whatever.com';
        return false;
    
      } else if ( /* some other tests using letter and number */) {
        window.location.href = 'http://whatever.com';
        return false;
    
      } else if ( /* and so on... */) {
        /* whatever */
        return false;
      }
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a javascript bookmark to take the url I have in the clipboard
I have some settings I need in a Javascript file -- servers to connect
I am currently developing a site and have a need for a javascript-based carousel/slider
I have the following problem: I have a form I need to serialize but
I have the following situation and I know have a lot of this subject
I am in a need of a solution for mobile devices, which will allow
I need JavaScript working almost perfectly in my application that should be able to
I need a JavaScript library that supports Ajax as well as help me in
I need a Javascript application that, when run, prompts a password to be entered,
I need the JavaScript code to iterate through the filled attributes in an HTML

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.