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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:23:00+00:00 2026-06-15T07:23:00+00:00

The scenario is: User choose a entry from dropDown list. Referring to the relevant

  • 0

The scenario is: User choose a entry from dropDown list. Referring to the relevant entry i will create a new prefix for the webpath existing in . But the problem I have, the will not interpret as a link part, so the link won’t be generated!
Use Case: If User choose link1 from dropDown-list, the result should be:https://link1//web/sso/bw/ostrfer.jsp (as link and as text display)

Could you help me how I can reach this?

Many thanks for your help! 🙂

JS:

function output (choice) {


 var index =  choice.selectedIndex;
 var prefix = "";



  if(index == 1) 
prefix = "https://link1";

   else if (index == 2) 
prefix = "https://link2;    

  else if (index == 3) 
prefix = "https://link3";   

  else if (index == 4) 
prefix = "https://link4";   

  else if (index == 5) 
prefix = ""https://link5";



document.getElementById("url").innerHTML = praefix;

}

HTML:

 <body>

   <form>
    <p>
 <select id = "list" name = "list" onchange ='output(this.form.liste);' >

<option></option>
<option>link1</option>
<option>link2</option>
<option>link3</option>
<option>link4</option>
<option>link5</option>



</select>


</p>

</form>




<a href=<span id = "url"></span>/web/sso/bw/ostrfer.jsp> <span id = "url"></span>    /web/sso/bw/ostrfer.jsp</a>

</body>
  • 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-15T07:23:02+00:00Added an answer on June 15, 2026 at 7:23 am

    See this demo:
    http://jsfiddle.net/JFqrH/3/

    HTML:

    <form>
        <p>
           <select id = "list" name = "list" onchange ='output(this);' >    
              <option></option>
              <option>link1</option>
              <option>link2</option>
              <option>link3</option>
              <option>link4</option>
              <option>link5</option>
           </select>
       </p>
       <a id="url" href="/web/sso/bw/ostrfer.jsp">/web/sso/bw/ostrfer.jsp</a>
       <a id="url1" href="/web/sso/bw/ostrfer.jsp">/web/sso/bw/ostrfer1.jsp</a>
       <a id="url2" href="/web/sso/bw/ostrfer.jsp">/web/sso/bw/ostrfer2.jsp</a>
    </form>​
    

    JS:

    function output (choice) {
       var index =  choice.selectedIndex;
       var prefix = "";
       if(index == 1) 
         prefix = "https://link1";    
       else if (index == 2) 
         prefix = "https://link2";        
      else if (index == 3) 
        prefix = "https://link3";       
      else if (index == 4) 
        prefix = "https://link4";       
      else if (index == 5) 
        prefix = "https://link5";    
    
       updateLink(document.getElementById("url"), prefix);
       updateLink(document.getElementById("url1"), prefix);
       updateLink(document.getElementById("url2"), prefix);
    }​
    function updateLink(url, prefix) {
       if(!url.getAttribute("postfix")) {// need to save orignal href as it will be replaced later
            url.setAttribute("postfix", url.getAttribute("href"));                
       }
       var postfix = url.getAttribute("postfix");
       url.innerHTML = prefix + postfix;
       url.href = prefix + postfix;    
    
    }
    

    You have multiple syntax errors in your code. Plus a href=<span id = "url"></span> is nonsence. It can’t work. Instead of that you should use attributes (see getAttribute/setAttribute). Also, it is much simpler to use swithc statement instead of if/else. Another thing: onchange=output(this.form.liste); – instead of this you can use onchange=output(this); as this will already point to your dropdown element there.

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

Sidebar

Related Questions

I have the following scenario: My page has a dropdown list that allows user
In my project there is a scenario that user will log in -> browse
I have a scenario where a user will have access to a one-time-url. When
We have a scenario where the user can choose between different hardware at runtime.
Im looking for upload and crop image in PHP. The scenario is: user choose
Relatively new to MVC and trying to get a cascading dropdown list working for
Scenario: User A send application request to user B User B accepts request after
Scenario: User X1 logged in. He can not be logged again. up to previous
This is the standard scenario: User registers on the site User receives an account
I've following scenario: The user loads home.html , selects a subset of the five

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.